|
Hibernate example source code file (EhCacheRegionFactoryImpl.java)
The Hibernate EhCacheRegionFactoryImpl.java source codepackage org.hibernate.test.cache.ehcache; import org.hibernate.cache.ehcache.EhCacheRegionFactory; import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; import java.lang.reflect.Field; import java.util.Map; /** * @author Alex Snaps */ public class EhCacheRegionFactoryImpl extends EhCacheTest { @Override protected void configCache(final Configuration cfg) { cfg.setProperty( Environment.CACHE_REGION_FACTORY, EhCacheRegionFactory.class.getName() ); cfg.setProperty( Environment.CACHE_PROVIDER_CONFIG, "ehcache.xml" ); } @Override protected Map getMapFromCacheEntry(final Object entry) { final Map map; if ( "org.hibernate.cache.ehcache.internal.strategy.AbstractReadWriteEhcacheAccessStrategy$Item".equals( entry.getClass() .getName() ) ) { try { Field field = entry.getClass().getDeclaredField( "value" ); field.setAccessible( true ); map = (Map) field.get( entry ); } catch ( NoSuchFieldException e ) { throw new RuntimeException( e ); } catch ( IllegalAccessException e ) { throw new RuntimeException( e ); } } else { map = (Map) entry; } return map; } } Other Hibernate examples (source code examples)Here is a short list of links related to this Hibernate EhCacheRegionFactoryImpl.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.