-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PetOwner, User, Veterinarian, UserType and PetType created.
- Loading branch information
Showing
8 changed files
with
163 additions
and
8 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
src/main/java/database/MedType.java → src/main/java/Entities/MedType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/database/Medication.java → src/main/java/Entities/Medication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package database; | ||
package Entities; | ||
|
||
import jakarta.persistence.*; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package Entities; | ||
|
||
import jakarta.persistence.*; | ||
|
||
@Entity | ||
@Table(name = "PetOwner") | ||
public class PetOwner{ | ||
@Id | ||
private int PetOwnerID; | ||
@OneToOne(cascade = CascadeType.ALL) | ||
@JoinColumn(name = "UserID", referencedColumnName = "UserID") | ||
private User UserID; | ||
private int PetID; | ||
|
||
private int VetID; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package Entities; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
|
||
@Entity | ||
@Table(name = "PetType") | ||
public class PetType { | ||
@Id | ||
private int PetTypeID; | ||
private String Type; | ||
|
||
public int getPetTypeID() { | ||
return PetTypeID; | ||
} | ||
public void setPetTypeID(int petTypeID) { | ||
PetTypeID = petTypeID; | ||
} | ||
public String getType() { | ||
return Type; | ||
} | ||
public void setType(String type) { | ||
Type = type; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package Entities; | ||
|
||
import jakarta.persistence.*; | ||
|
||
@Entity | ||
@Table(name = "User") | ||
public class User { | ||
@Id | ||
private int UserID; | ||
private String Name; | ||
private String Surname; | ||
private String Email; | ||
private String Password; | ||
@ManyToOne | ||
@JoinColumn(name = "UserTypeID", referencedColumnName = "UserTypeID") | ||
private UserType UserTypeID; | ||
@OneToOne(mappedBy = "Veterinarian", cascade = CascadeType.ALL) | ||
private Veterinarian Vet; | ||
@OneToOne(mappedBy = "PetOwner", cascade = CascadeType.ALL) | ||
private PetOwner Owner; | ||
|
||
public int getUserID() { | ||
return UserID; | ||
} | ||
public void setUserID(int userID) { | ||
UserID = userID; | ||
} | ||
public String getName() { | ||
return Name; | ||
} | ||
public void setName(String name) { | ||
Name = name; | ||
} | ||
public String getSurname() { | ||
return Surname; | ||
} | ||
public void setSurname(String surname) { | ||
Surname = surname; | ||
} | ||
public String getEmail() { | ||
return Email; | ||
} | ||
public void setEmail(String email) { | ||
Email = email; | ||
} | ||
public String getPassword() { | ||
return Password; | ||
} | ||
public void setPassword(String password) { | ||
Password = password; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package Entities; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.OneToMany; | ||
import jakarta.persistence.Table; | ||
|
||
import java.util.List; | ||
|
||
@Entity | ||
@Table(name = "UserType") | ||
public class UserType { | ||
@Id | ||
private int UserTypeID; | ||
private String Type; | ||
@OneToMany(mappedBy = "UserType") | ||
private List<User> Users; | ||
|
||
public int getUserTypeID() { | ||
return UserTypeID; | ||
} | ||
public void setUserTypeID(int userTypeID) { | ||
UserTypeID = userTypeID; | ||
} | ||
public String getType() { | ||
return Type; | ||
} | ||
public void setType(String type) { | ||
Type = type; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package Entities; | ||
|
||
import jakarta.persistence.*; | ||
|
||
@Entity | ||
@Table(name = "Veterinarian") | ||
public class Veterinarian{ | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private int VetID; | ||
@OneToOne | ||
private User UserID; | ||
private String Clinic; | ||
|
||
public String getClinic() { | ||
return Clinic; | ||
} | ||
public void setClinic(String clinic) { | ||
Clinic = clinic; | ||
} | ||
public User getUserID() { | ||
return UserID; | ||
} | ||
public void setUserID(User userID) { | ||
UserID = userID; | ||
} | ||
public int getVetID() { | ||
return VetID; | ||
} | ||
public void setVetID(int vetID) { | ||
VetID = vetID; | ||
} | ||
} |