Bonjour à tous,
Suite à la requete suivante :
Lorsqu'il n'y à aucun résultat pas de pb
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 public static List getProf()throws Exception{ Session session = HibernateUtil.currentSession(); List profil = null ; String user = "USER" ; try { profil = session.createQuery("from Profil p where p.role = '" + user + "'").list(); } catch (Exception e) { System.out.print("Erreur_hibernate dans get Prof " + e); } finally { HibernateUtil.closeSession(); } return profil; }
Lorsqu'il y a 1 résultat pas de pb
Mais dès qu'il y en a 2 ou plus j'ai l'erreur org.hibernate.SessionException: Session is closed!
Une idée
Partager