-->
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.  [ 6 posts ] 
Author Message
 Post subject: Updated records not reflected while fetching
PostPosted: Fri Feb 29, 2008 2:51 am 
Newbie

Joined: Fri Feb 29, 2008 2:22 am
Posts: 5
Hi,

I am doing bulk update operation inside the for loop which is run inside the transaction. After the execution of this code block, database get updated. But when i try to fetch the updated records, i am getting the list of objects which i had before update.

in my hibernate configuration, i configured cache.provider_class = org.hibernate.cache.NoCacheProvider

does any one knows why this is happening?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 29, 2008 3:12 am 
Newbie

Joined: Tue Dec 11, 2007 12:28 am
Posts: 5
Check whether ur hibernate configuration file has the "autocommit" set to "true".

or else, try committing ur transaction after u say "session.save()" as
"tx.commit()"

if its still not working, try to post the part of the code along with the log file.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 29, 2008 3:52 am 
Newbie

Joined: Fri Feb 29, 2008 2:22 am
Posts: 5
Hi,

My code block looks like this,

Transaction tx = session.beginTransaction();
for loop {

session.saveOrUpdate(entity);
session.persist(entity);
}

tx.commit();
seesion.close();


In logs i can see that update statement get fired and database get updated.

My problem is after it get updated in database, i query the updated table to get all records, it returns me old entities not the updated entity.

but if i again refresh the page by ctrl+R, i get the updated records.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 29, 2008 4:13 am 
Newbie

Joined: Tue Dec 11, 2007 12:28 am
Posts: 5
hey, then it may not be the problem of hibernate at all !!
it may be ur browser refreshing problem..
just remove ur browser cache and run the application in a new browser.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 29, 2008 5:30 am 
Newbie

Joined: Fri Feb 29, 2008 2:22 am
Posts: 5
Hi,

I tried that but no luck...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 03, 2008 8:22 am 
Newbie

Joined: Fri Feb 29, 2008 2:22 am
Posts: 5
Thanks guys..

It was browser cache problem. I resolved it successfully.


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