I am doing a simple web page and I have a NurseForm entity. When the nurse sees a patient he/she fills this form.
One of this form field is “Actions done” which is basically an enum with:
public enum NurseAction {
GIVE_MEDICINE, PERFORM_SUTURE, SPRAY_THERAPY, NEBULIZATIONS;
}
A nurse can perform more than one action so I have a property:
private Collection<NurseAction> nurseActions;
From what I understand I need NurseAction to be an Entity, but if I do so I should populate the db by hand.
Can I avoid that? Which is the best way to solve this?
PS: I am a complete newbie to Hibernate.
You can try using
@CollectionOfElements(targetElement=NurseAction.class)(you can try to omit the attribute and let hibernate assume it based on the type parameter of the collection)Note that this annotation is deprecated in hibernate 3.5, in favour of the same annotation from JPA 2.0.