Revision df390232
Added by Cherian Mathew almost 9 years ago
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CacheLoader.java | ||
---|---|---|
20 | 20 |
import net.sf.ehcache.Element; |
21 | 21 |
|
22 | 22 |
import org.apache.log4j.Logger; |
23 |
import org.hibernate.proxy.HibernateProxy; |
|
24 |
import org.hibernate.proxy.LazyInitializer; |
|
25 | 23 |
import org.springframework.util.ReflectionUtils; |
26 | 24 |
|
27 | 25 |
import eu.etaxonomy.cdm.model.ICdmCacher; |
... | ... | |
331 | 329 |
cdmEntityInSubGraph = (CdmBase)o; |
332 | 330 |
CdmBase cachedCdmEntityInSubGraph = cdmCacher.getFromCache(cdmEntityInSubGraph); |
333 | 331 |
|
334 |
Object oldCachedCdmEntityInSubGraph = field.get(cachedCdmEntity); |
|
335 |
if(ProxyUtils.isProxy(oldCachedCdmEntityInSubGraph)) { |
|
336 |
LazyInitializer hli = |
|
337 |
((HibernateProxy)oldCachedCdmEntityInSubGraph).getHibernateLazyInitializer(); |
|
338 |
|
|
339 |
if(cdmEntityInSubGraph.getId() == ((Integer)hli.getIdentifier()).intValue()) { |
|
340 |
// exception 1 : is the case where |
|
341 |
// the earlier value of the field in the cached entity |
|
342 |
// was a proxy with the same id then we don't need to |
|
343 |
// update it here as it will be updated on demand, |
|
344 |
// so we reset it to the earlier proxy |
|
345 |
field.set(cachedCdmEntity, oldCachedCdmEntityInSubGraph); |
|
346 |
return null; |
|
347 |
} |
|
348 |
} |
|
332 |
// Object oldCachedCdmEntityInSubGraph = field.get(cachedCdmEntity);
|
|
333 |
// if(ProxyUtils.isProxy(oldCachedCdmEntityInSubGraph)) {
|
|
334 |
// LazyInitializer hli =
|
|
335 |
// ((HibernateProxy)oldCachedCdmEntityInSubGraph).getHibernateLazyInitializer();
|
|
336 |
// |
|
337 |
// if(cdmEntityInSubGraph.getId() == ((Integer)hli.getIdentifier()).intValue()) {
|
|
338 |
// // exception 1 : is the case where
|
|
339 |
// // the earlier value of the field in the cached entity
|
|
340 |
// // was a proxy with the same id then we don't need to
|
|
341 |
// // update it here as it will be updated on demand,
|
|
342 |
// // so we reset it to the earlier proxy
|
|
343 |
// field.set(cachedCdmEntity, oldCachedCdmEntityInSubGraph);
|
|
344 |
// return null;
|
|
345 |
// }
|
|
346 |
// }
|
|
349 | 347 |
|
350 | 348 |
if(cachedCdmEntityInSubGraph != null) { |
351 | 349 |
if(cachedCdmEntityInSubGraph != cdmEntityInSubGraph) { |
Also available in: Unified diff
RemotingSessionAwareTest : added new class which handles pre-config of test classes which require a session
*Test.java : set super class to RemotingSessionAwareTest
*.xml : removed DefinedTermBase entites from datasets so that the terms are not deleted
ServiceInterceptorTest : correction