-->
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.  [ 1 post ] 
Author Message
 Post subject: Select IN criteria query and caching
PostPosted: Thu Sep 21, 2006 4:30 pm 
Newbie

Joined: Sun Nov 21, 2004 7:52 pm
Posts: 7
Location: Montr
Hibernate version: 3.1.2

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Criteria crit = session.createCriteria(Domain.class);
crit.add(Restrictions.eq("inForce", Bool.TRUE));
crit.add( Property.forName("domainId").in( domainNumbers ) );

return crit.setCacheable(true).list();


Name and version of the database you are using: DB2 400

Is there something with the IN property of my criteria query that avoid caching my objects (Domain) ?

If a use a simple load by criteria with cacheable to true, Domain's objects are cached.

example of criteria that caches perfectly my Domains:

final Criteria crit = session.createCriteria(Domain.class).add(Restrictions.eq("domainId", domainId)).setCacheable(true);
return crit.uniqueResult();



Read this: http://hibernate.org/42.html

_________________
Hibernate user, trying to get the best of it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.