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.
|