• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session is closed

 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm quite amazed, because it never happened to me before, and cant figure out what's going on

i've this class:


as you can see, if i run it like it is, i get that error msg; if i uncomment, then everything runs ok

what's going on?

TiA
 
Pierre Sugar
Ranch Hand
Posts: 62
Java Ruby Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I understand it runs if you first close the session and then ask for the current session. Right? To see what is going on you should make the HibernateUtil class available, I didn't find this in the Hibernate API.
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i use the same code (t = s.beginTransaction()) lots of times in my code and allways works fine... except with this method...

this class is from Hibernate authors:


EDIT:
now that i look at it, i remember i adapted it to java5
[ September 04, 2005: Message edited by: miguel lisboa ]
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i sorted it out!

i used that method in a test; in this test, before i call it i inserted something into database, and, at the end, instead of closing session like:

HibernateUtil.closeSession()

i used (wrongly):

s.closeSession()

that's it
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic