1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| public ChargeAffaire findChargeAffaire(Integer id) {
EntityManager em = getEntityManager();
try {
return em.find(ChargeAffaire.class, id);
} finally {
em.close();
}
}
public List<ChargeAffaire> findChargeAffaireEntities() {
return findChargeAffaireEntities(true, -1, -1);
}
public List<ChargeAffaire> findChargeAffaireEntities(int maxResults, int firstResult) {
return findChargeAffaireEntities(false, maxResults, firstResult);
}
private List<ChargeAffaire> findChargeAffaireEntities(boolean all, int maxResults, int firstResult) {
EntityManager em = getEntityManager();
try {
Query q = em.createQuery("select object(o) from ChargeAffaire as o");
if (!all) {
q.setMaxResults(maxResults);
q.setFirstResult(firstResult);
}
return q.getResultList();
} finally {
em.close();
}
} |
Partager