Ejemplo n.º 1
0
 public static void delete(TroopMovementWrapper troopMovementWrapper)
     throws NoTransactionException {
   DAOManager.beforeDelete(TroopMovementWrapper.class);
   if (HibernateUtil.getEntityManager().getTransaction().isActive()) {
     HibernateUtil.getEntityManager().remove(troopMovementWrapper);
     DAOManager.afterDelete(TroopMovementWrapper.class);
   } else {
     DAOManager.afterDelete(TroopMovementWrapper.class);
     throw new NoTransactionException();
   }
 }
Ejemplo n.º 2
0
  @SuppressWarnings("unchecked")
  public static List<TroopMovementWrapper> findAll() {
    DAOManager.beforeFind(TroopMovementWrapper.class, "findAll");

    List<TroopMovementWrapper> list =
        (List<TroopMovementWrapper>)
            HibernateUtil.getEntityManager()
                .createQuery("select x from TroopMovementWrapper x")
                .getResultList();

    DAOManager.afterFind(TroopMovementWrapper.class, "findAll");

    return list;
  }