Fix Pet entity ID mapping for JPA compatibility
This commit is contained in:
@@ -14,7 +14,8 @@ public class Pet {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long petId;
|
||||
@Column(name = "petId")
|
||||
private Long id;
|
||||
|
||||
@Column(nullable = false, length = 50)
|
||||
private String petName;
|
||||
@@ -45,8 +46,8 @@ public class Pet {
|
||||
public Pet() {
|
||||
}
|
||||
|
||||
public Pet(Long petId, String petName, String petSpecies, String petBreed, Integer petAge, String petStatus, BigDecimal petPrice, LocalDateTime createdAt, LocalDateTime updatedAt) {
|
||||
this.petId = petId;
|
||||
public Pet(Long id, String petName, String petSpecies, String petBreed, Integer petAge, String petStatus, BigDecimal petPrice, LocalDateTime createdAt, LocalDateTime updatedAt) {
|
||||
this.id = id;
|
||||
this.petName = petName;
|
||||
this.petSpecies = petSpecies;
|
||||
this.petBreed = petBreed;
|
||||
@@ -58,11 +59,11 @@ public class Pet {
|
||||
}
|
||||
|
||||
public Long getPetId() {
|
||||
return petId;
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setPetId(Long petId) {
|
||||
this.petId = petId;
|
||||
public void setPetId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getPetName() {
|
||||
@@ -134,18 +135,18 @@ public class Pet {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Pet pet = (Pet) o;
|
||||
return Objects.equals(petId, pet.petId);
|
||||
return Objects.equals(id, pet.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(petId);
|
||||
return Objects.hash(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Pet{" +
|
||||
"petId=" + petId +
|
||||
"id=" + id +
|
||||
", petName='" + petName + '\'' +
|
||||
", petSpecies='" + petSpecies + '\'' +
|
||||
", petBreed='" + petBreed + '\'' +
|
||||
|
||||
Reference in New Issue
Block a user