예제 #1
0
  public WorkUnit save(WorkUnit wu) {
    entityManager.getTransaction().begin();

    WorkUnit ret;
    if (wu.getId() == 0) {
      entityManager.persist(wu);
      ret = wu;
    } else {
      ret = entityManager.merge(wu);
    }

    entityManager.getTransaction().commit();

    return ret;
  }