-->
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: FindbyId and findByName
PostPosted: Wed Apr 08, 2009 12:06 pm 
Newbie

Joined: Mon Apr 06, 2009 4:32 pm
Posts: 4
Hi ,

I've a table with a primaryKey - "id" and a unique, not-null column - "name"

When I load a row by using currentSession().get(clazz, id), then this object is cached in the session cache and any further get doesn't fire an actual sql.

However, when I use a HQL "from user u where name:name" to retrieve the same object, the query is fired everytime. using setCacheable(true) also doesn't help.

Any idea how I can stop firing this query more than once in a single session?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 08, 2009 12:23 pm 
Expert
Expert

Joined: Thu Jan 08, 2009 6:16 am
Posts: 661
Location: Germany
Maybe enabling the query cache could help: http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#performance-querycache

_________________
-----------------
Need advanced help? http://www.viada.eu


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.