-
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.
medication entity and foreign keys are added
- Loading branch information
1 parent
1023b68
commit 9ab6af7
Showing
3 changed files
with
112 additions
and
9 deletions.
There are no files selected for viewing
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,62 @@ | ||
package database; | ||
|
||
import jakarta.persistence.*; | ||
|
||
@Entity | ||
@Table(name="Medication") | ||
|
||
public class Medication { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private int medicationID; | ||
private String medicationName; | ||
@ManyToOne | ||
@JoinColumn(name="MedTypeID",referencedColumnName = "MedTypeID") | ||
private MedType MedTypeID; | ||
|
||
@ManyToOne | ||
@JoinColumn(name="ScheduleID",referencedColumnName = "ScheduleID") | ||
private Schedule ScheduleID; | ||
|
||
private int PetID; | ||
|
||
public int getMedicationID() { | ||
return medicationID; | ||
} | ||
|
||
public void setMedicationID(int medicationID) { | ||
this.medicationID = medicationID; | ||
} | ||
|
||
public String getMedicationName() { | ||
return medicationName; | ||
} | ||
|
||
public void setMedicationName(String medicationName) { | ||
this.medicationName = medicationName; | ||
} | ||
|
||
public MedType getMedTypeID() { | ||
return MedTypeID; | ||
} | ||
|
||
public void setMedTypeID(MedType medTypeID) { | ||
MedTypeID = medTypeID; | ||
} | ||
|
||
public Schedule getScheduleID() { | ||
return ScheduleID; | ||
} | ||
|
||
public void setScheduleID(Schedule scheduleID) { | ||
ScheduleID = scheduleID; | ||
} | ||
|
||
public int getPetID() { | ||
return PetID; | ||
} | ||
|
||
public void setPetID(int petID) { | ||
PetID = petID; | ||
} | ||
} |
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,19 +1,56 @@ | ||
package database; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
import jakarta.persistence.*; | ||
import net.sf.jsqlparser.expression.DateTimeLiteralExpression; | ||
|
||
import java.util.List; | ||
|
||
@Entity | ||
@Table(name="Schedule") | ||
|
||
public class Schedule { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
int ScheduleID; | ||
DateTimeLiteralExpression.DateTime beginningDate; | ||
int doseFrequency; | ||
int doseCount; | ||
@OneToMany(mappedBy = "Medication") | ||
List<Medication> medicationList; | ||
private DateTimeLiteralExpression.DateTime beginningDate; | ||
private int doseFrequency; | ||
private int doseCount; | ||
|
||
public int getScheduleID() { | ||
return ScheduleID; | ||
} | ||
|
||
public void setScheduleID(int scheduleID) { | ||
ScheduleID = scheduleID; | ||
} | ||
|
||
public DateTimeLiteralExpression.DateTime getBeginningDate() { | ||
return beginningDate; | ||
} | ||
|
||
public void setBeginningDate(DateTimeLiteralExpression.DateTime beginningDate) { | ||
this.beginningDate = beginningDate; | ||
} | ||
|
||
public int getDoseFrequency() { | ||
return doseFrequency; | ||
} | ||
|
||
public void setDoseFrequency(int doseFrequency) { | ||
this.doseFrequency = doseFrequency; | ||
} | ||
|
||
public int getDoseCount() { | ||
return doseCount; | ||
} | ||
|
||
public void setDoseCount(int doseCount) { | ||
this.doseCount = doseCount; | ||
} | ||
|
||
|
||
|
||
|
||
} |