-->
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.  [ 2 posts ] 
Author Message
 Post subject: Secon read over criteria.list() method with old data
PostPosted: Tue May 06, 2008 8:35 am 
Newbie

Joined: Tue May 06, 2008 8:01 am
Posts: 4
Hibernate version:3.X

If I read data over the method session.createCriteria(BusinessObject.class).list I got the right data. I update the data over a other session.
If I read the data again over the first session I got the old data.
Some other Hibernate user have the same problem. But all solutions which are described will not solve the problem. So I have debug the hibernate methods. I analyse that the method doQuery() in the Load class will call getObjectFromResultSet(...) an this method getRow(...).
GetRow read the entity out of the PersistenceContext (First Level Cahce)
and if the Object exist in the PersistenceContext the new value form
the result set will be ignore. I saw now chance to update the Business Object. Cache setting will not solve the problem. Transaction settings
will not solve the problem. Only a session.clear() wich will call devict() for
all Persistence Objects solve it. But I will not clear() the whole session.
What can I do ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 06, 2008 9:16 am 
Regular
Regular

Joined: Mon Aug 06, 2007 10:49 am
Posts: 67
Location: Banska Bystrica, Slovakia
u can call method session.refresh(object) - which re-read state of object from db

or can evict just one object - session.evict(object) from session, and load him again


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.