HHH-12544 - Add jipijapa hook to plug in specialized caching and transaction services

This commit is contained in:
Steve Ebersole 2018-05-08 10:55:26 -05:00
parent 350d330159
commit ed136d5f52
2 changed files with 7 additions and 44 deletions

View File

@ -33,17 +33,23 @@ import static org.jboss.as.jpa.hibernate5.JpaLogger.JPA_LOGGER;
* Implements the PersistenceProviderAdaptor for Hibernate
*
* @author Scott Marlow
* @author Steve Ebersole
*/
public class HibernatePersistenceProviderAdaptor implements PersistenceProviderAdaptor, TwoPhaseBootstrapCapable {
@SuppressWarnings("WeakerAccess")
public static final String NAMING_STRATEGY_JPA_COMPLIANT_IMPL = "org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl";
private static final String HIBERNATE_EXTENDED_BEANMANAGER = "org.hibernate.resource.beans.container.spi.ExtendedBeanManager";
@SuppressWarnings("WeakerAccess")
public static final String HIBERNATE_EXTENDED_BEANMANAGER = "org.hibernate.resource.beans.container.spi.ExtendedBeanManager";
private volatile JtaManager jtaManager;
private volatile Platform platform;
private static final String NONE = SharedCacheMode.NONE.name();
@Override
public void injectJtaManager(JtaManager jtaManager) {
// todo : why? `this.jtaManager` is never used aside from setting here in this method
if ( this.jtaManager != jtaManager ) {
this.jtaManager = jtaManager;
}
@ -59,12 +65,6 @@ public class HibernatePersistenceProviderAdaptor implements PersistenceProviderA
@Override
@SuppressWarnings({"deprecation", "unchecked"})
public void addProviderProperties(Map properties, PersistenceUnitMetadata pu) {
putPropertyIfAbsent(
pu,
properties,
AvailableSettings.JPAQL_STRICT_COMPLIANCE,
"true"
); // JIPI-24 ignore jpql aliases case
putPropertyIfAbsent( pu, properties, AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "true" );
putPropertyIfAbsent( pu, properties, AvailableSettings.KEYWORD_AUTO_QUOTING_ENABLED, "false" );
putPropertyIfAbsent(
@ -75,12 +75,6 @@ public class HibernatePersistenceProviderAdaptor implements PersistenceProviderA
);
putPropertyIfAbsent( pu, properties, AvailableSettings.SCANNER, HibernateArchiveScanner.class );
properties.put( AvailableSettings.APP_CLASSLOADER, pu.getClassLoader() );
putPropertyIfAbsent(
pu,
properties,
AvailableSettings.JTA_PLATFORM,
new JBossAppServerJtaPlatform( jtaManager )
);
putPropertyIfAbsent(
pu,
properties,

View File

@ -1,31 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.jboss.as.jpa.hibernate5;
import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform;
import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatformProvider;
/**
* @author Scott Marlow
*/
public class JtaPlatformProviderImpl implements JtaPlatformProvider {
private static volatile JBossAppServerJtaPlatform delegate;
public static JBossAppServerJtaPlatform getDelegate() {
return delegate;
}
public static void setDelegate(JBossAppServerJtaPlatform delegate) {
JtaPlatformProviderImpl.delegate = delegate;
}
@Override
public JtaPlatform getProvidedJtaPlatform() {
return delegate;
}
}