1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| public static List get_dernierDocument() {
System.out.print("appel de la fonction");
List documents=null;
String req="select max(h.IdDoc) from Document as h";
Transaction tx = null;
Session session = HibernateSessionFactory.getInstance().getCurrentSession();
try {
tx = session.beginTransaction();
documents = session.createQuery(req).list();
tx.commit();
}catch (HibernateException e) {
e.printStackTrace();
if (tx != null && tx.isActive())
tx.rollback();
}
return documents;
} |