-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: org.hibernate.SessionException: Session is closed!
PostPosted: Fri Nov 09, 2007 6:16 am 
Beginner
Beginner

Joined: Thu Aug 09, 2007 3:48 pm
Posts: 38
I am loading a class with reflection (Class.forName())
Then inside its ctor (which i called with newInstance() method), I try to use
sessionFactory.getCurrentSession();
But when i start using the session i get, it throws the following exception:

Code:
org.hibernate.SessionException: Session is closed!
   at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:49)
   at org.hibernate.impl.SessionImpl.getPersistenceContext(SessionImpl.java:1823)
   at org.hibernate.loader.Loader.endCollectionLoad(Loader.java:877)
   at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:865)
   at org.hibernate.loader.Loader.doQuery(Loader.java:729)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
   at org.hibernate.loader.Loader.loadCollection(Loader.java:1994)
   at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)
   at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:565)


Any idea why after loading the class by reflection it fail to find the current session, or what should i do in this case.
I tried to open another session, but that just causes more problems later, when it says same collection tries to be used by 2 sessions.....

Please help


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 10, 2007 10:44 am 
Beginner
Beginner

Joined: Thu Aug 09, 2007 3:48 pm
Posts: 38
ping


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 11, 2007 1:25 pm 
Beginner
Beginner

Joined: Thu Aug 09, 2007 3:48 pm
Posts: 38
bump


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.