-->
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: hibernate criteria cached ?
PostPosted: Thu Nov 22, 2007 9:43 am 
Beginner
Beginner

Joined: Wed Oct 03, 2007 9:46 pm
Posts: 37
Criteria crit = sess.createCriteria(TableObj.class,"table_name")
.add( Restrictions.like("id", "%"+keyword+"%") )
.addOrder(bSortOrder ? Order.asc(sortColumnId): Order.desc(sortColumnId))
.setFirstResult(nFirst)
.setMaxResults(nPageSize);

Is this statement cached by default? after first time i executed it and followed by update of a field in the table and re-execute this statement again. It's still displaying my old record. Is c3p0 pooling cache this?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 26, 2007 3:16 am 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Hi,

If you are using session do flush the session.
i.e) session.flush()

If you have already flushed the session, refresh the session.
i.e) session.refresh()

Ideally when you refresh the session the inserted record should be in the List.

Which database are u using???
If you are using MySql. Check to see whether you have set this in config file.
transaction-isolation = READ-COMMITED"

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


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.