-->
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: Hibernate session.refresh in hibernate pagination
PostPosted: Tue Jul 29, 2008 9:56 am 
Newbie

Joined: Tue Jul 01, 2008 7:30 am
Posts: 11
Location: Pune,India
Hi All,


I want to retrieve updated values from table using select query.
I used session.flush but it didnt worked.
my criteria is as below:

List lst = session.createCriteria(Entity.class).list();

when i navigate back ,even though changes in the DB , it does not reflect in the result set.

Please let me know what i should go for.

Thanks in advance.

--Sidh


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 30, 2008 7:56 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Who is updating the values, if not your Hibernate Session?

If you close the Session and reopen it again, do you get the latest values?

Hibernate maintains a cache of data so round trips to the database aren't required. If someone undermines Hibernate with direct database updates, you're in trouble.

Close the Session and open a new Hibernate Session and you should get the updated, uncached values. You could also rerun the query or try to do a refresh. Otherwise, you may want to lock your table when Hibernate has selected values.

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 30, 2008 9:54 am 
Newbie

Joined: Tue Jul 01, 2008 7:30 am
Posts: 11
Location: Pune,India
Hi Cameron,

Thanks for the reply. Some owner is responsible for updating the values in the table. Im using hibernate pagination , and closing and opening session for every page , still not getting the updated values.

as im using session criteria for selection of values , not able to refresh the session , is there is any way for doing this?

Please let me know your views on same.

Its required for me to fetch the updated records . even the record has updated in between the page navigation .

Thanks,
--Sidh


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.