Pb Synchronisation de session
qlq 1 connait il la cause de cette erreur:
Could not synchronize database state with session.
on fait voila:
je recupere une liste d objet on faisant appel a cette methode:
Code:
1 2 3 4 5 6 7 8 9 10 11
| public List lectureCandidat() throws HibernateException{
Session s = HibernateUtil.currentSession();
List listeCandidats = s.find("from Candidats");
Transaction tx= s.beginTransaction();
tx.commit();
//HibernateUtil.closeSession();
return listeCandidats;
} |
Quad je ferme la session j ai une erruer d ou le://HibernateUtil.closeSession();
Apres je modifier un objet de la liste au je fait une maj en faisant appel a cet methode:
Code:
1 2 3 4 5 6 7
| public void updateCandidat(Candidats cand) throws HibernateException{
Session s = HibernateUtil.currentSession();
Transaction tx= s.beginTransaction();
s.saveOrUpdate(cand);
tx.commit();
HibernateUtil.closeSession();
return ; |
et la j ai l erreur:Could not synchronize database state with session
Merci pour votre aide.