From e42ebe816f67dfa3c424e448bd76b372a3201345 Mon Sep 17 00:00:00 2001 From: Brian Stansberry Date: Sat, 23 Feb 2008 23:47:41 +0000 Subject: [PATCH] Ensure that queries are segregated from entities/collections if they use the same region name git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@14350 1b8cb986-b30d-0410-93ca-fae66ebed9b2 --- .../hibernate/cache/jbc2/query/QueryResultsRegionImpl.java | 4 ++-- .../test/cache/jbc2/query/QueryRegionImplTestCase.java | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/query/QueryResultsRegionImpl.java b/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/query/QueryResultsRegionImpl.java index 3d5b206894..fd9f9291ee 100644 --- a/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/query/QueryResultsRegionImpl.java +++ b/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/query/QueryResultsRegionImpl.java @@ -43,7 +43,7 @@ import org.jboss.cache.config.Option; public class QueryResultsRegionImpl extends TransactionalDataRegionAdapter implements QueryResultsRegion { public static final String QUERY_CACHE_LOCAL_ONLY_PROP = "hibernate.cache.region.jbc2.query.localonly"; - + public static final String TYPE = "QUERY"; /** * Whether we should set an option to disable propagation of changes around @@ -134,7 +134,7 @@ public class QueryResultsRegionImpl extends TransactionalDataRegionAdapter imple @Override protected Fqn createRegionFqn(String regionName, String regionPrefix) { - return Fqn.fromString(escapeRegionName(regionName, regionPrefix)); + return getTypeLastRegionFqn(regionName, regionPrefix, TYPE); } } diff --git a/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/query/QueryRegionImplTestCase.java b/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/query/QueryRegionImplTestCase.java index 6aba0288a9..451ae192a3 100644 --- a/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/query/QueryRegionImplTestCase.java +++ b/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/query/QueryRegionImplTestCase.java @@ -36,6 +36,7 @@ import org.hibernate.cache.StandardQueryCache; import org.hibernate.cache.jbc2.BasicRegionAdapter; import org.hibernate.cache.jbc2.CacheInstanceManager; import org.hibernate.cache.jbc2.JBossCacheRegionFactory; +import org.hibernate.cache.jbc2.query.QueryResultsRegionImpl; import org.hibernate.cfg.Configuration; import org.hibernate.test.cache.jbc2.AbstractGeneralDataRegionTestCase; import org.hibernate.test.util.CacheTestUtil; @@ -83,7 +84,7 @@ public class QueryRegionImplTestCase extends AbstractGeneralDataRegionTestCase { @Override protected Fqn getRegionFqn(String regionName, String regionPrefix) { - return Fqn.fromString(BasicRegionAdapter.escapeRegionName(regionName, regionPrefix)); + return BasicRegionAdapter.getTypeLastRegionFqn(regionName, regionPrefix, QueryResultsRegionImpl.TYPE); } public void testPutDoesNotBlockGetOptimistic() throws Exception {