Example #1
0
 public void removeMed(String med_name) {
   for (Medication med : meds) {
     if (med.getMed_name().equals(med_name)) {
       meds.remove(meds.indexOf(med));
     }
   }
 }
Example #2
0
 public Medication getMed(String med_name) {
   for (Medication med : meds) {
     if (med.getMed_name().equals(med_name)) {
       return med;
     }
   }
   return null;
 }
Example #3
0
  public void testJoinedSubclass() throws HibernateException, SQLException {
    Medication m = new Medication();

    m.setPrescribedDrug(new Drug());

    m.getPrescribedDrug().setName("Morphine");

    Session s = openSession();

    s.save(m.getPrescribedDrug());
    s.save(m);

    s.flush();
    s.connection().commit();
    s.close();
    s = openSession();

    Medication m2 = (Medication) s.get(Medication.class, m.getId());
    assertNotSame(m, m2);

    s.flush();
    s.connection().commit();
    s.close();
  }