Hey,
we re using Jboss 5.1 with JPA in our application. Cache mode for our entities is transactional.
The issue is that for certain queries the cache is ignored, e.g:
Code:
core.createQuery("select sr.site from SiteRole sr where sr.person = :person order by sr.siteRoleId asc").setParameter("person", p).setHint("org.hibernate.cacheable", true).getResultList();
However, if I'm changing the query to:
Code:
core.createQuery("select sr.site from SiteRole sr where sr.person.personId = :person order by sr.siteRoleId asc").setParameter("person", p.getPersonId().setHint("org.hibernate.cacheable", true).getResultList();
it is retrieved via the cache without DB roundtrip.
The only difference is that instead of setting the person object as query parameter I'm just using its ID.
The cache mode of the Person entity itself is also transactional.
Any hints what I'm missing here?
Thanks, Chris