-->
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: Use of object that was persisted in same session
PostPosted: Thu Sep 01, 2005 9:54 am 
Newbie

Joined: Wed Jun 08, 2005 10:45 am
Posts: 3
Hibernate version: 3.05

If I create a new object with lazy associations, persist it, then try to reference the associations in the same session I find that they are null. The only solution I know of is either close the session and continue processing with a new session, or evict the object and load it again in the same session.

Is there another way to handle this situation ?


Top
 Profile  
 
 Post subject: Session --> check Cache
PostPosted: Thu Sep 01, 2005 10:28 am 
Newbie

Joined: Wed Jul 20, 2005 6:08 am
Posts: 8
I had a similar problem with lazy collection, with OsCache and EhCache.

Check cache that used Hibernate and i resolved with flush this cache and session.
I used Session.flush() and OsCache flush operations.


Top
 Profile  
 
 Post subject: Refresh is what I needed
PostPosted: Thu Sep 01, 2005 12:25 pm 
Newbie

Joined: Wed Jun 08, 2005 10:45 am
Posts: 3
It appears that the proper way to handle this is to refresh the object that was persisted after you save it. session.refresh(object)

This is better than evict and refetch because it can be done within the same transaction.


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.