• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Session is closed

 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 62
Ruby Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Roses are red, violets are blue. Some poems rhyme and some don't. And some poems are a tiny ad.
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic