Skip to content

Commit

Permalink
Pet and PetOwner has been connected.
Browse files Browse the repository at this point in the history
  • Loading branch information
FruTooTi committed Dec 9, 2023
1 parent 5130a31 commit 110c1a2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/main/java/Entities/Pet.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ public class Pet {
@JoinColumn(name = "PetTypeID", referencedColumnName = "PetTypeID")
private PetType PetTypeID;
private String Description;
@ManyToOne
@JoinColumn(name = "PetOwnerID", referencedColumnName = "PetOwnerID")
private PetOwner PetOwnerID;
@OneToMany(mappedBy = "Appointments")
private List<Appointment> Appointments;

Expand Down Expand Up @@ -49,4 +52,16 @@ public String getDescription() {
public void setDescription(String description) {
Description = description;
}
public PetOwner getPetOwnerID() {
return PetOwnerID;
}
public void setPetOwnerID(PetOwner petOwnerID) {
PetOwnerID = petOwnerID;
}
public List<Appointment> getAppointments() {
return Appointments;
}
public void setAppointments(List<Appointment> appointments) {
Appointments = appointments;
}
}
3 changes: 2 additions & 1 deletion src/main/java/Entities/PetOwner.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ public class PetOwner{
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "UserID", referencedColumnName = "UserID")
private User User;
private int PetID;
@OneToMany(mappedBy = "Pet")
private List<Pet> Pets;
@ManyToOne
@JoinColumn(name = "VetID", referencedColumnName = "VetID")
private Veterinarian Vet;
Expand Down

0 comments on commit 110c1a2

Please sign in to comment.