From 772fe48fd4ac532f3ef2629e833dc71ebba3636d Mon Sep 17 00:00:00 2001 From: Paul Ferraro Date: Tue, 27 Mar 2018 19:43:45 -0400 Subject: [PATCH] Port 2nd level cache integration to use infinispan-hibernate-cache-spi module. Move deprecated RegionFactory implementations to a separate legacy module. --- component-matrix/pom.xml | 11 +++ feature-pack/pom.xml | 8 ++ .../jipijapa-hibernate5/main/module.xml | 1 + .../hibernate-cache/main/module.xml | 3 + jpa/hibernate5-legacy/pom.xml | 53 ++++++++++ .../infinispan/InfinispanRegionFactory.java | 40 ++++++++ .../SharedInfinispanRegionFactory.java | 43 +++++++++ jpa/hibernate5/pom.xml | 8 +- .../hibernate5/HibernateSecondLevelCache.java | 15 ++- .../ManagedEmbeddedCacheManagerProvider.java | 96 +++++++++++++++++++ .../infinispan/InfinispanRegionFactory.java | 82 ---------------- .../SharedInfinispanRegionFactory.java | 72 -------------- jpa/pom.xml | 1 + .../Hibernate2LCacheStatsTestCase.java | 6 +- .../HibernateSecondLevelCacheTestCase.java | 3 +- 15 files changed, 275 insertions(+), 167 deletions(-) create mode 100644 jpa/hibernate5-legacy/pom.xml create mode 100644 jpa/hibernate5-legacy/src/main/java/org/jboss/as/jpa/hibernate5/infinispan/InfinispanRegionFactory.java create mode 100644 jpa/hibernate5-legacy/src/main/java/org/jboss/as/jpa/hibernate5/infinispan/SharedInfinispanRegionFactory.java create mode 100644 jpa/hibernate5/src/main/java/org/jboss/as/jpa/hibernate5/ManagedEmbeddedCacheManagerProvider.java delete mode 100644 jpa/hibernate5/src/main/java/org/jboss/as/jpa/hibernate5/infinispan/InfinispanRegionFactory.java delete mode 100644 jpa/hibernate5/src/main/java/org/jboss/as/jpa/hibernate5/infinispan/SharedInfinispanRegionFactory.java diff --git a/component-matrix/pom.xml b/component-matrix/pom.xml index 99a55a868334..64fcf29108a2 100644 --- a/component-matrix/pom.xml +++ b/component-matrix/pom.xml @@ -321,6 +321,11 @@ + + ${project.groupId} + jipijapa-hibernate5-legacy + ${project.version} + ${project.groupId} @@ -3808,6 +3813,12 @@ + + + org.infinispan + infinispan-hibernate-cache-spi + ${version.org.infinispan} + org.infinispan infinispan-hibernate-cache-commons diff --git a/feature-pack/pom.xml b/feature-pack/pom.xml index a6339d30023d..388417b223a9 100644 --- a/feature-pack/pom.xml +++ b/feature-pack/pom.xml @@ -900,6 +900,10 @@ + + ${project.groupId} + jipijapa-hibernate5-legacy + ${project.groupId} @@ -2255,6 +2259,10 @@ + + org.infinispan + infinispan-hibernate-cache-spi + org.javassist diff --git a/feature-pack/src/main/resources/modules/system/layers/base/org/hibernate/jipijapa-hibernate5/main/module.xml b/feature-pack/src/main/resources/modules/system/layers/base/org/hibernate/jipijapa-hibernate5/main/module.xml index 6c7b0584f191..740279c53c61 100644 --- a/feature-pack/src/main/resources/modules/system/layers/base/org/hibernate/jipijapa-hibernate5/main/module.xml +++ b/feature-pack/src/main/resources/modules/system/layers/base/org/hibernate/jipijapa-hibernate5/main/module.xml @@ -29,6 +29,7 @@ + diff --git a/feature-pack/src/main/resources/modules/system/layers/base/org/infinispan/hibernate-cache/main/module.xml b/feature-pack/src/main/resources/modules/system/layers/base/org/infinispan/hibernate-cache/main/module.xml index d02777f54608..aee9f425a01e 100644 --- a/feature-pack/src/main/resources/modules/system/layers/base/org/infinispan/hibernate-cache/main/module.xml +++ b/feature-pack/src/main/resources/modules/system/layers/base/org/infinispan/hibernate-cache/main/module.xml @@ -30,6 +30,7 @@ + @@ -39,8 +40,10 @@ + + diff --git a/jpa/hibernate5-legacy/pom.xml b/jpa/hibernate5-legacy/pom.xml new file mode 100644 index 000000000000..9cf3cd345ec1 --- /dev/null +++ b/jpa/hibernate5-legacy/pom.xml @@ -0,0 +1,53 @@ + + + + + + 4.0.0 + + + org.wildfly + wildfly-jpa-parent + + 13.0.0.Alpha1-SNAPSHOT + + + jipijapa-hibernate5-legacy + + jipijapa Hibernate 5.x (JPA 2.1) legacy integration + + + + + org.hibernate + hibernate-core + provided + + + org.infinispan + infinispan-hibernate-cache-v51 + provided + + + + diff --git a/jpa/hibernate5-legacy/src/main/java/org/jboss/as/jpa/hibernate5/infinispan/InfinispanRegionFactory.java b/jpa/hibernate5-legacy/src/main/java/org/jboss/as/jpa/hibernate5/infinispan/InfinispanRegionFactory.java new file mode 100644 index 000000000000..371f9ad887dc --- /dev/null +++ b/jpa/hibernate5-legacy/src/main/java/org/jboss/as/jpa/hibernate5/infinispan/InfinispanRegionFactory.java @@ -0,0 +1,40 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2013, Red Hat Middleware LLC, and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jboss.as.jpa.hibernate5.infinispan; + +import java.util.Properties; + +import org.hibernate.boot.spi.SessionFactoryOptions; +import org.hibernate.cache.CacheException; + +/** + * Infinispan-backed region factory for use with standalone (i.e. non-JPA) Hibernate applications. + * @author Paul Ferraro + * @author Scott Marlow + * @deprecated Use {@link org.infinispan.hibernate.cache.v51.InfinispanRegionFactory} instead in conjunction with "hibernate.cache.infinispan.shared" set to false. + */ +@Deprecated +public class InfinispanRegionFactory extends org.infinispan.hibernate.cache.v51.InfinispanRegionFactory { + private static final long serialVersionUID = 6526170943015350422L; + + @Override + public void start(SessionFactoryOptions settings, Properties properties) throws CacheException { + properties.setProperty("hibernate.cache.infinispan.shared", "false"); + super.start(settings, properties); + } +} diff --git a/jpa/hibernate5-legacy/src/main/java/org/jboss/as/jpa/hibernate5/infinispan/SharedInfinispanRegionFactory.java b/jpa/hibernate5-legacy/src/main/java/org/jboss/as/jpa/hibernate5/infinispan/SharedInfinispanRegionFactory.java new file mode 100644 index 000000000000..fe0e6ca8e390 --- /dev/null +++ b/jpa/hibernate5-legacy/src/main/java/org/jboss/as/jpa/hibernate5/infinispan/SharedInfinispanRegionFactory.java @@ -0,0 +1,43 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2013, Red Hat Middleware LLC, and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jboss.as.jpa.hibernate5.infinispan; + +import java.util.Properties; + +import org.hibernate.boot.spi.SessionFactoryOptions; +import org.hibernate.cache.CacheException; + +/** + * Infinispan-backed region factory that retrieves its cache manager from the Infinispan subsystem. + * This is used for (JPA) container managed persistence contexts. + * Each deployment application will use a unique Hibernate cache region name in the shared cache. + * + * @author Paul Ferraro + * @author Scott Marlow + * @deprecated Use {@link org.infinispan.hibernate.cache.v51.InfinispanRegionFactory} instead. + */ +@Deprecated +public class SharedInfinispanRegionFactory extends org.infinispan.hibernate.cache.v51.InfinispanRegionFactory { + private static final long serialVersionUID = -3277051412715973863L; + + @Override + public void start(SessionFactoryOptions settings, Properties properties) throws CacheException { + properties.setProperty("hibernate.cache.infinispan.shared", "true"); + super.start(settings, properties); + } +} diff --git a/jpa/hibernate5/pom.xml b/jpa/hibernate5/pom.xml index d4b3eb86a018..9a902c6a90ef 100644 --- a/jpa/hibernate5/pom.xml +++ b/jpa/hibernate5/pom.xml @@ -120,7 +120,7 @@ org.infinispan - infinispan-hibernate-cache-v51 + infinispan-hibernate-cache-spi provided @@ -130,6 +130,12 @@ provided + + org.kohsuke.metainf-services + metainf-services + provided + + javax.persistence javax.persistence-api diff --git a/jpa/hibernate5/src/main/java/org/jboss/as/jpa/hibernate5/HibernateSecondLevelCache.java b/jpa/hibernate5/src/main/java/org/jboss/as/jpa/hibernate5/HibernateSecondLevelCache.java index d385384cd60b..3de7f7bfcc61 100644 --- a/jpa/hibernate5/src/main/java/org/jboss/as/jpa/hibernate5/HibernateSecondLevelCache.java +++ b/jpa/hibernate5/src/main/java/org/jboss/as/jpa/hibernate5/HibernateSecondLevelCache.java @@ -27,15 +27,12 @@ import static org.infinispan.hibernate.cache.spi.InfinispanProperties.PENDING_PUTS_CACHE_RESOURCE_PROP; import static org.infinispan.hibernate.cache.spi.InfinispanProperties.QUERY_CACHE_RESOURCE_PROP; import static org.infinispan.hibernate.cache.spi.InfinispanProperties.TIMESTAMPS_CACHE_RESOURCE_PROP; -import static org.jboss.as.jpa.hibernate5.infinispan.InfinispanRegionFactory.CACHE_CONTAINER; -import static org.jboss.as.jpa.hibernate5.infinispan.InfinispanRegionFactory.DEFAULT_CACHE_CONTAINER; import java.util.HashSet; import java.util.Properties; import java.util.Set; import org.hibernate.cfg.AvailableSettings; -import org.jboss.as.jpa.hibernate5.infinispan.SharedInfinispanRegionFactory; import org.jipijapa.cache.spi.Classification; import org.jipijapa.event.impl.internal.Notification; @@ -46,9 +43,10 @@ */ public class HibernateSecondLevelCache { - private static final String DEFAULT_REGION_FACTORY = SharedInfinispanRegionFactory.class.getName(); + private static final String DEFAULT_REGION_FACTORY = "org.infinispan.hibernate.cache.v51.InfinispanRegionFactory"; public static final String CACHE_TYPE = "cachetype"; // shared (jpa) or private (for native applications) + public static final String CACHE_PRIVATE = "private"; public static final String CONTAINER = "container"; public static final String NAME = "name"; public static final String CACHES = "caches"; @@ -67,12 +65,12 @@ public static void addSecondLevelCacheDependencies(Properties mutableProperties, regionFactory = DEFAULT_REGION_FACTORY; mutableProperties.setProperty(AvailableSettings.CACHE_REGION_FACTORY, regionFactory); } - if (regionFactory.equals(DEFAULT_REGION_FACTORY)) { + if (Boolean.parseBoolean(mutableProperties.getProperty(ManagedEmbeddedCacheManagerProvider.SHARED, ManagedEmbeddedCacheManagerProvider.DEFAULT_SHARED))) { // Set infinispan defaults - String container = mutableProperties.getProperty(CACHE_CONTAINER); + String container = mutableProperties.getProperty(ManagedEmbeddedCacheManagerProvider.CACHE_CONTAINER); if (container == null) { - container = DEFAULT_CACHE_CONTAINER; - mutableProperties.setProperty(CACHE_CONTAINER, container); + container = ManagedEmbeddedCacheManagerProvider.DEFAULT_CACHE_CONTAINER; + mutableProperties.setProperty(ManagedEmbeddedCacheManagerProvider.CACHE_CONTAINER, container); } /** @@ -93,6 +91,7 @@ public static Set findCaches(Properties properties) { caches.add(properties.getProperty(IMMUTABLE_ENTITY_CACHE_RESOURCE_PROP, DEF_ENTITY_RESOURCE)); caches.add(properties.getProperty(COLLECTION_CACHE_RESOURCE_PROP, DEF_ENTITY_RESOURCE)); caches.add(properties.getProperty(NATURAL_ID_CACHE_RESOURCE_PROP, DEF_ENTITY_RESOURCE)); + if (properties.containsKey(PENDING_PUTS_CACHE_RESOURCE_PROP)) { caches.add(properties.getProperty(PENDING_PUTS_CACHE_RESOURCE_PROP)); } diff --git a/jpa/hibernate5/src/main/java/org/jboss/as/jpa/hibernate5/ManagedEmbeddedCacheManagerProvider.java b/jpa/hibernate5/src/main/java/org/jboss/as/jpa/hibernate5/ManagedEmbeddedCacheManagerProvider.java new file mode 100644 index 000000000000..007d53e7b0c0 --- /dev/null +++ b/jpa/hibernate5/src/main/java/org/jboss/as/jpa/hibernate5/ManagedEmbeddedCacheManagerProvider.java @@ -0,0 +1,96 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2018, Red Hat, Inc., and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.as.jpa.hibernate5; + +import java.util.Properties; + +import org.hibernate.cache.CacheException; +import org.hibernate.cfg.AvailableSettings; +import org.infinispan.hibernate.cache.spi.EmbeddedCacheManagerProvider; +import org.infinispan.manager.EmbeddedCacheManager; +import org.infinispan.manager.impl.AbstractDelegatingEmbeddedCacheManager; +import org.jipijapa.cache.spi.Classification; +import org.jipijapa.cache.spi.Wrapper; +import org.jipijapa.event.impl.internal.Notification; +import org.kohsuke.MetaInfServices; + +/** + * Provides a managed {@link EmbeddedCacheManager} instance to Infinispan's region factory implementation. + * @author Paul Ferraro + */ +@MetaInfServices(EmbeddedCacheManagerProvider.class) +public class ManagedEmbeddedCacheManagerProvider implements EmbeddedCacheManagerProvider { + public static final String CACHE_CONTAINER = "hibernate.cache.infinispan.container"; + public static final String DEFAULT_CACHE_CONTAINER = "hibernate"; + public static final String SHARED = "hibernate.cache.infinispan.shared"; + public static final String DEFAULT_SHARED = "true"; + + @Override + public EmbeddedCacheManager getEmbeddedCacheManager(Properties properties) { + + Properties settings = new Properties(); + String container = properties.getProperty(CACHE_CONTAINER, DEFAULT_CACHE_CONTAINER); + settings.setProperty(HibernateSecondLevelCache.CONTAINER, container); + + if (!Boolean.parseBoolean(properties.getProperty(SHARED, DEFAULT_SHARED))) { + HibernateSecondLevelCache.addSecondLevelCacheDependencies(properties, null); + + settings.setProperty(HibernateSecondLevelCache.CACHE_TYPE, HibernateSecondLevelCache.CACHE_PRIVATE); + + // Find a suitable service name to represent this session factory instance + String name = properties.getProperty(AvailableSettings.SESSION_FACTORY_NAME); + if (name != null) { + settings.setProperty(HibernateSecondLevelCache.NAME, name); + } + + settings.setProperty(HibernateSecondLevelCache.CACHES, String.join(" ", HibernateSecondLevelCache.findCaches(properties))); + } + + try { + return new JipiJapaCacheManager(Notification.startCache(Classification.INFINISPAN, settings)); + } catch (CacheException e) { + throw e; + } catch (Exception e) { + throw new CacheException(e); + } + } + + private static class JipiJapaCacheManager extends AbstractDelegatingEmbeddedCacheManager { + private final Wrapper wrapper; + + JipiJapaCacheManager(Wrapper wrapper) { + super((EmbeddedCacheManager) wrapper.getValue()); + this.wrapper = wrapper; + } + + @Override + public void stop() { + Notification.stopCache(Classification.INFINISPAN, this.wrapper); + } + + @Override + public void close() { + this.stop(); + } + } +} diff --git a/jpa/hibernate5/src/main/java/org/jboss/as/jpa/hibernate5/infinispan/InfinispanRegionFactory.java b/jpa/hibernate5/src/main/java/org/jboss/as/jpa/hibernate5/infinispan/InfinispanRegionFactory.java deleted file mode 100644 index 29029c552a9b..000000000000 --- a/jpa/hibernate5/src/main/java/org/jboss/as/jpa/hibernate5/infinispan/InfinispanRegionFactory.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2013, Red Hat Middleware LLC, and individual contributors - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jboss.as.jpa.hibernate5.infinispan; - -import java.util.Properties; - -import org.hibernate.cache.CacheException; -import org.hibernate.cfg.AvailableSettings; -import org.hibernate.service.ServiceRegistry; -import org.infinispan.manager.EmbeddedCacheManager; -import org.jboss.as.jpa.hibernate5.HibernateSecondLevelCache; -import org.jipijapa.cache.spi.Classification; -import org.jipijapa.cache.spi.Wrapper; -import org.jipijapa.event.impl.internal.Notification; - -/** - * Infinispan-backed region factory for use with standalone (i.e. non-JPA) Hibernate applications. - * @author Paul Ferraro - * @author Scott Marlow - */ -public class InfinispanRegionFactory extends org.infinispan.hibernate.cache.v51.InfinispanRegionFactory { - private static final long serialVersionUID = 6526170943015350422L; - - public static final String CACHE_CONTAINER = "hibernate.cache.infinispan.container"; - public static final String DEFAULT_CACHE_CONTAINER = "hibernate"; - public static final String CACHE_PRIVATE = "private"; - - private volatile Wrapper wrapper; - - public InfinispanRegionFactory() { - super(); - } - - public InfinispanRegionFactory(Properties props) { - super(props); - } - - @Override - protected EmbeddedCacheManager createCacheManager(Properties properties, final ServiceRegistry serviceRegistry) throws CacheException { - // Find a suitable service name to represent this session factory instance - String name = properties.getProperty(AvailableSettings.SESSION_FACTORY_NAME); - String container = properties.getProperty(CACHE_CONTAINER, DEFAULT_CACHE_CONTAINER); - HibernateSecondLevelCache.addSecondLevelCacheDependencies(properties, null); - - Properties cacheSettings = new Properties(); - cacheSettings.setProperty(HibernateSecondLevelCache.CACHE_TYPE, CACHE_PRIVATE); - cacheSettings.setProperty(HibernateSecondLevelCache.CONTAINER, container); - if (name != null) { - cacheSettings.setProperty(HibernateSecondLevelCache.NAME, name); - } - cacheSettings.setProperty(HibernateSecondLevelCache.CACHES, String.join(" ", HibernateSecondLevelCache.findCaches(properties))); - - try { - // start a private cache for non-JPA use and return the started cache. - wrapper = Notification.startCache(Classification.INFINISPAN, cacheSettings); - return (EmbeddedCacheManager)wrapper.getValue(); - } catch (Exception e) { - throw new CacheException(e); - } - } - - @Override - protected void stopCacheManager() { - // stop the private cache - Notification.stopCache(Classification.INFINISPAN, wrapper); - } -} diff --git a/jpa/hibernate5/src/main/java/org/jboss/as/jpa/hibernate5/infinispan/SharedInfinispanRegionFactory.java b/jpa/hibernate5/src/main/java/org/jboss/as/jpa/hibernate5/infinispan/SharedInfinispanRegionFactory.java deleted file mode 100644 index 66bef5eca7e2..000000000000 --- a/jpa/hibernate5/src/main/java/org/jboss/as/jpa/hibernate5/infinispan/SharedInfinispanRegionFactory.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2013, Red Hat Middleware LLC, and individual contributors - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jboss.as.jpa.hibernate5.infinispan; - -import java.util.Properties; - -import org.hibernate.cache.CacheException; -import org.hibernate.service.ServiceRegistry; -import org.infinispan.manager.EmbeddedCacheManager; -import org.jboss.as.jpa.hibernate5.HibernateSecondLevelCache; -import org.jipijapa.cache.spi.Classification; -import org.jipijapa.cache.spi.Wrapper; -import org.jipijapa.event.impl.internal.Notification; - -/** - * Infinispan-backed region factory that retrieves its cache manager from the Infinispan subsystem. - * This is used for (JPA) container managed persistence contexts. - * Each deployment application will use a unique Hibernate cache region name in the shared cache. - * - * @author Paul Ferraro - * @author Scott Marlow - */ -public class SharedInfinispanRegionFactory extends InfinispanRegionFactory { - private static final long serialVersionUID = -3277051412715973863L; - private volatile Wrapper wrapper; - public SharedInfinispanRegionFactory() { - super(); - } - - public SharedInfinispanRegionFactory(Properties props) { - super(props); - } - - @Override - protected EmbeddedCacheManager createCacheManager(Properties properties, final ServiceRegistry serviceRegistry) { - String container = properties.getProperty(CACHE_CONTAINER, DEFAULT_CACHE_CONTAINER); - Properties cacheSettings = new Properties(); - cacheSettings.put(HibernateSecondLevelCache.CONTAINER, container); - try { - // Get the (shared) cache manager for JPA application use - wrapper = Notification.startCache(Classification.INFINISPAN, cacheSettings); - return (EmbeddedCacheManager)wrapper.getValue(); - } catch (Exception e) { - throw new CacheException(e); - } - } - - /** - * Do not attempt to stop our cache manager because it wasn't created by this region factory. - * Base class stop() will call the base stopCacheRegions() - */ - @Override - protected void stopCacheManager() { - // notify that the cache is not used but skip the stop since its shared for all jpa applications. - Notification.stopCache(Classification.INFINISPAN, wrapper); - } -} diff --git a/jpa/pom.xml b/jpa/pom.xml index f99c0af4d5ac..052b1dbc1411 100644 --- a/jpa/pom.xml +++ b/jpa/pom.xml @@ -25,6 +25,7 @@ hibernate4_1 hibernate4_3 hibernate5 + hibernate5-legacy eclipselink openjpa diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/hibernate/Hibernate2LCacheStatsTestCase.java b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/hibernate/Hibernate2LCacheStatsTestCase.java index 3d04f98177cf..3fe4271dc50a 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/hibernate/Hibernate2LCacheStatsTestCase.java +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/hibernate/Hibernate2LCacheStatsTestCase.java @@ -55,8 +55,8 @@ @RunWith(Arquillian.class) public class Hibernate2LCacheStatsTestCase { - private static final String FACTORY_CLASS = "org.jboss.as.jpa.hibernate5.infinispan.InfinispanRegionFactory"; - private static final String MODULE_DEPENDENCIES = "Dependencies: org.infinispan export,org.hibernate.envers export,org.hibernate\n"; + private static final String FACTORY_CLASS = "org.infinispan.hibernate.cache.v51.InfinispanRegionFactory"; + private static final String MODULE_DEPENDENCIES = "Dependencies: org.hibernate.envers export,org.hibernate\n"; private static final String ARCHIVE_NAME = "hibernateSecondLevelStats_test"; @@ -66,7 +66,7 @@ public class Hibernate2LCacheStatsTestCase { + "" + "false" + "true" + "false" + FACTORY_CLASS - + "java:jboss/infinispan/container/hibernate" + + "false" + "" + ""; public static final String testmapping = "" + "org.jboss.as.jpa.hibernate5.infinispan.InfinispanRegionFactory"; + private static final String FACTORY_CLASS = "org.infinispan.hibernate.cache.v51.InfinispanRegionFactory"; private static final String MODULE_DEPENDENCIES = "Dependencies: org.hibernate.envers export,org.hibernate\n"; private static final String ARCHIVE_NAME = "hibernateSecondLevel_test"; @@ -63,6 +63,7 @@ public class HibernateSecondLevelCacheTestCase { + "true" + "false" + FACTORY_CLASS + + "false" + "" + ""; public static final String testmapping = "" + "