-->
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.  [ 1 post ] 
Author Message
 Post subject: EAGER loading problem with EHCache
PostPosted: Tue Dec 06, 2011 9:49 am 
Newbie

Joined: Tue Dec 06, 2011 8:29 am
Posts: 1
Hello Every One,

MY Environment:
JBoss: GA 4.2.3
EJB: 3.0
Hibernate: 3.2.4.sp1
EHCache: 2.4.6
EHCache Configuration:
<property name="hibernate.cache.provider_class" value="net.sf.ehcache.hibernate.SingletonEhCacheProvider" />
<property name="hibernate.cache.use_second_level_cache" value="true" />

I have an association From Class A to class B
@ManyToMany(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER, mappedBy = "mListA", targetEntity = B.class) and Cache
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
private List<B> mListB = new ArrayList<B>();

and from Class B to ClassA
@ManyToMany(cascade = CascadeType.REFRESH, fetch = FetchType.EAGAR, targetEntity = A.class)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
private List<A> mListA = new ArrayList<A>();

Problem: (values in the Database are absolutely fine)
1. I am putting some objects of Class B into a collection(Class B) of Class A in a transaction &
and in next transaction I am listing all Class B objects and from mListA I am trying access a collection Class B
and I am always getting empty values (of Class B).

My guess was (may be I am totally wrong) that
1. While putting the objects into collection cache is not updated properly
2. & while loading it might always hitting the cache & returning from there only without hitting the database (may be because of eagerness).
3. Therefore I see empty values.

If I say lazy every thing work fine.
because I need to load my collections eagerly can any one give some I idea where I am going wrong & how to resolve the issue.

Thanks in Advance,
Jagan.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.