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