-->
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: Second level cache on the object reference
PostPosted: Tue May 04, 2010 3:41 pm 
Beginner
Beginner

Joined: Thu Nov 02, 2006 2:23 pm
Posts: 33
I have manager (1:m) ---> employee

I set second level cache on the manager and on the employee and the relation is eager.

how ever load manager go to the second level cache but when iterate on employes go to the DB- any idea?


Top
 Profile  
 
 Post subject: Re: Second level cache on the object reference
PostPosted: Wed May 05, 2010 7:54 am 
Regular
Regular

Joined: Thu May 07, 2009 5:56 am
Posts: 94
Location: Toulouse, France
maybe you have forgotten to activate collection caching...?
Code:
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)   
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region = "hibernate")
List<Employee> myEmployees = new ArrayList<Employee>();

tip: I think LAZY fetching is better strategy than EAGER when you use second cache level cache.

_________________
everything should be made as simple as possible, but not simpler (AE)


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.