-->
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: Query cache with misses in case of entity parameter
PostPosted: Fri Jan 28, 2011 8:28 am 
Newbie

Joined: Sun Feb 11, 2007 3:42 pm
Posts: 8
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


Top
 Profile  
 
 Post subject: Re: Query cache with misses in case of entity parameter
PostPosted: Tue Feb 01, 2011 8:08 am 
Newbie

Joined: Sun Feb 11, 2007 3:42 pm
Posts: 8
no ideas?

- Chris


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.