Author: steve.ebersole(a)jboss.com
Date: 2010-01-25 13:49:02 -0500 (Mon, 25 Jan 2010)
New Revision: 18621
Modified:
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/cacheable/annotation/ConfigurationTest.java
Log:
HHH-4659 - Add support for standard declarative cache (@Cacheable)
Modified:
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/cacheable/annotation/ConfigurationTest.java
===================================================================
---
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/cacheable/annotation/ConfigurationTest.java 2010-01-25
17:57:07 UTC (rev 18620)
+++
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/cacheable/annotation/ConfigurationTest.java 2010-01-25
18:49:02 UTC (rev 18621)
@@ -26,6 +26,9 @@
import java.util.Properties;
import javax.persistence.SharedCacheMode;
+import org.hibernate.cache.access.AccessType;
+import org.hibernate.cache.impl.NoCachingRegionFactory;
+import org.hibernate.cfg.Environment;
import org.hibernate.ejb.AvailableSettings;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.junit.UnitTestCase;
@@ -109,6 +112,7 @@
private Ejb3Configuration buildConfiguration(SharedCacheMode mode) {
Properties properties = new Properties();
properties.put( AvailableSettings.SHARED_CACHE_MODE, mode );
+ properties.put( Environment.CACHE_REGION_FACTORY, CustomRegionFactory.class.getName()
);
Ejb3Configuration config = new Ejb3Configuration();
config.setProperties( properties );
config.addAnnotatedClass( ExplicitlyCacheableEntity.class );
@@ -117,4 +121,15 @@
config.buildMappings();
return config;
}
+
+ public static class CustomRegionFactory extends NoCachingRegionFactory {
+ public CustomRegionFactory(Properties properties) {
+ super( properties );
+ }
+
+ @Override
+ public AccessType getDefaultAccessType() {
+ return AccessType.READ_WRITE;
+ }
+ }
}
Show replies by date