예제 #1
0
  @Override
  public void addThings() {
    ManagerLocal manager = new Manager();
    Collection<ElectiveDTO> els = manager.getProposedElectives();

    for (ElectiveDTO s : els) {
      System.out.println(1);
      Elective el =
          new Elective(s.getTitle(), s.getDescription(), s.getDate(), "" + s.getProposed());

      entityManager.persist(el);
    }
  }
예제 #2
0
  @Override
  public boolean addElective(ElectiveDTO e) {

    Elective el =
        new Elective(
            e.getElectiveID(), e.getTitle(), e.getDescription(), new Date(), e.getProposed());

    try {
      entityManager.persist(el);
    } catch (EntityExistsException ex) {
      ex.printStackTrace();
      return false;
    } catch (IllegalArgumentException ex) {
      ex.printStackTrace();
      return false;
    } catch (TransactionRequiredException ex) {
      ex.printStackTrace();
      return false;
    }
    return true;
  }