Beispiel #1
0
 /**
  * Updates the given subject with the given data.
  *
  * @param subject The subject to be updated
  * @param code The subject code
  * @param name The subject name
  * @param educationType
  */
 public void update(Subject subject, String code, String name, EducationType educationType) {
   EntityManager entityManager = getEntityManager();
   subject.setCode(code);
   subject.setName(name);
   subject.setEducationType(educationType);
   entityManager.persist(subject);
 }
Beispiel #2
0
 /**
  * Creates a new subject.
  *
  * @param code The subject code
  * @param name The subject name
  * @param educationType
  * @return The created subject
  */
 public Subject create(String code, String name, EducationType educationType) {
   EntityManager entityManager = getEntityManager();
   Subject subject = new Subject();
   subject.setName(name);
   subject.setCode(code);
   subject.setEducationType(educationType);
   entityManager.persist(subject);
   return subject;
 }