-->
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.  [ 3 posts ] 
Author Message
 Post subject: A question about what can be cached
PostPosted: Mon Sep 26, 2011 9:53 am 
Newbie

Joined: Wed Oct 31, 2007 6:04 am
Posts: 8
Location: Cologne, Germany
Hi all,

I just ran into a very strange problem concerning caching. It appears with both EHCache as well as OSCache so I guess it's Hibernate-related. However I'm not versed in the inner workings of the caching mechanism as it always has been something that just worked, so I hope that someone can illuminate me on what's going on.

Given the following query:
Code:
SELECT title.versions FROM CopyrightTitle title WHERE title.worknumber=:worknumber OR :worknumber IN ELEMENTS(title.additionalWorknumbers)

If I enable caching, the first run yields the correct result but any subsequent calls will return a list containing a null element.
Now when I rewrite the query to select the whole title object and then use title.getVersions() in my method, everything works as expected. I haven't specified a fetch strategy on the @OneToMany relation so it should be eagerly fetched.

All the best
Marcus


Top
 Profile  
 
 Post subject: Re: A question about what can be cached
PostPosted: Mon Oct 03, 2011 5:58 am 
Newbie

Joined: Sun Oct 02, 2011 12:19 pm
Posts: 1
Hello. I have the same problem. Have you found a solution?


Top
 Profile  
 
 Post subject: Re: A question about what can be cached
PostPosted: Wed Oct 05, 2011 6:40 am 
Newbie

Joined: Wed Oct 31, 2007 6:04 am
Posts: 8
Location: Cologne, Germany
Sadly, no. I have more or less worked around the problem by selecting the parent object and retrieving its associated collection by hand.
I once read somewhere that caching can be problematic in the case of lazily-loaded collections but that is clearly not the case here.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.