-->
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.  [ 1 post ] 
Author Message
 Post subject: refresh query result
PostPosted: Mon Dec 12, 2005 4:48 am 
Newbie

Joined: Tue Sep 20, 2005 9:00 am
Posts: 5
Location: Austria
I have the following problem refreshing a list of objects:

Loading data with "createQuery(...).getResultList()" returns a list of objects. Now an object gets changed in the database by some other means. Refreshing the list of objects with the identical query fetches the objects from the database again but then sees that this object is already cached and returns the cached object (containing stale data).

In my case the query could use @Version to detect changes, but the version check is only done when the LockMode changes (which doesn't, as I just want to refresh the data displayed)

Calling refresh(obj) on the other hand for all objects in the list gives the correct result, but that is not an option as the number of objects could change too.

Any way to circumvent caching here or use the @Version attribute to detect the changes?

Info:
Hibernate Annotations 3.1b5, Entity Manager 3.1b3, Oracle DB
Code:
Code:
   teps=(List<Tep>)Ejb3Util.createQuery("SELECT p FROM Tep p"
               +" WHERE p.id.teid=:teid"
               +" ORDER BY p.artnr")
               .setParameter("teid",teid)
               .getResultList();

_________________
Richard Schwaninger


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

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.