-->
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: .uniqueResult() to return same reference
PostPosted: Mon Feb 20, 2006 1:41 pm 
Newbie

Joined: Mon Aug 01, 2005 12:15 pm
Posts: 3
how can I get two Query calls to return the same reference if it is the same query arguments.

I have tried .setCacheable(true) with <property name="cache.use_query_cache">true</property> but it doesn't work?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 20, 2006 8:06 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
The query cache caches only ids. You could change your query to return ids, then use get(id) to get the instance in the session cache.

Check out section 15.9, "Queries by natural identifier", for some optimization tips. If you do change your queries, this will help.


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.