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