HHH-12858 - Persistence.createEntityManagerFactory(Map) should allow overwriting jta-data-source of persistence.xml
This commit is contained in:
parent
4ff3c0b6e4
commit
57fba402b4
|
@ -1,5 +1,3 @@
|
||||||
import org.apache.tools.ant.filters.ReplaceTokens
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,405 @@
|
||||||
|
/*
|
||||||
|
* 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.hibernate.orm.test.bootstrap;
|
||||||
|
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
import javax.persistence.EntityManagerFactory;
|
||||||
|
import javax.persistence.spi.PersistenceProvider;
|
||||||
|
import javax.persistence.spi.PersistenceUnitInfo;
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
import org.hibernate.cfg.AvailableSettings;
|
||||||
|
import org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl;
|
||||||
|
import org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl;
|
||||||
|
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
|
import org.hibernate.jpa.HibernatePersistenceProvider;
|
||||||
|
|
||||||
|
import org.hibernate.testing.FailureExpected;
|
||||||
|
import org.hibernate.testing.env.ConnectionProviderBuilder;
|
||||||
|
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||||
|
import org.hibernate.testing.util.jpa.DelegatingPersistenceUnitInfo;
|
||||||
|
import org.hibernate.testing.util.jpa.PersistenceUnitInfoAdapter;
|
||||||
|
import org.hibernate.testing.util.jpa.PersistenceUnitInfoPropertiesWrapper;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.hamcrest.CoreMatchers.containsString;
|
||||||
|
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||||
|
import static org.hamcrest.CoreMatchers.is;
|
||||||
|
import static org.hamcrest.CoreMatchers.notNullValue;
|
||||||
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Steve Ebersole
|
||||||
|
*/
|
||||||
|
public class PersistenceUnitOverridesTests extends BaseUnitTestCase {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCustomProviderPassingIntegrationJpaJdbcOverrides() {
|
||||||
|
PersistenceProvider provider = new HibernatePersistenceProvider() {
|
||||||
|
@Override
|
||||||
|
public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map integrationOverrides) {
|
||||||
|
return super.createContainerEntityManagerFactory(
|
||||||
|
new DelegatingPersistenceUnitInfo( info ) {
|
||||||
|
@Override
|
||||||
|
public Properties getProperties() {
|
||||||
|
// use the "db1" connection settings keyed by the JPA property names (org.hibernate.cfg.AvailableSettings.JPA_JDBC_DRIVER, e.g.)
|
||||||
|
final Properties properties = new Properties();
|
||||||
|
properties.putAll( info.getProperties() );
|
||||||
|
properties.putAll( ConnectionProviderBuilder.getJpaConnectionProviderProperties( "db1" ) );
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
integrationOverrides
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// however, use the "db2" JPA connection settings which should override the persistence unit values
|
||||||
|
final Map integrationOverrides = ConnectionProviderBuilder.getJpaConnectionProviderProperties( "db2" );
|
||||||
|
|
||||||
|
final EntityManagerFactory emf = provider.createContainerEntityManagerFactory(
|
||||||
|
new PersistenceUnitInfoPropertiesWrapper(),
|
||||||
|
integrationOverrides
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
final Map<String, Object> properties = emf.getProperties();
|
||||||
|
|
||||||
|
final Object hibernateJdbcDriver = properties.get( AvailableSettings.URL );
|
||||||
|
assertThat( hibernateJdbcDriver, notNullValue() );
|
||||||
|
|
||||||
|
final Object jpaJdbcDriver = properties.get( AvailableSettings.JPA_JDBC_URL );
|
||||||
|
assertThat( (String) jpaJdbcDriver, containsString( "db2" ) );
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
emf.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testPassingIntegrationJpaJdbcOverridesForJtaDataSourceProperty() {
|
||||||
|
PersistenceProvider provider = new HibernatePersistenceProvider() {
|
||||||
|
@Override
|
||||||
|
public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map integrationOverrides) {
|
||||||
|
return super.createContainerEntityManagerFactory(
|
||||||
|
new DelegatingPersistenceUnitInfo( info ) {
|
||||||
|
|
||||||
|
// inject a JPA JTA DataSource setting into the PU
|
||||||
|
final DataSource puDataSource;
|
||||||
|
final Properties puProperties;
|
||||||
|
|
||||||
|
{
|
||||||
|
puDataSource = new DataSourceImpl( "puDataSource" );
|
||||||
|
|
||||||
|
puProperties = new Properties();
|
||||||
|
puProperties.putAll( info.getProperties() );
|
||||||
|
puProperties.put( AvailableSettings.JPA_JTA_DATASOURCE, puDataSource );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Properties getProperties() {
|
||||||
|
return puProperties;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
integrationOverrides
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
final EntityManagerFactory emf = provider.createContainerEntityManagerFactory(
|
||||||
|
new PersistenceUnitInfoAdapter(),
|
||||||
|
// however, provide JPA connection settings as "integration settings", which according to JPA spec should override the persistence unit values.
|
||||||
|
// - note that it is unclear in the spec whether JDBC value in the integration settings should override
|
||||||
|
// a JTA DataSource (nor the reverse). However, that is a useful thing to support
|
||||||
|
ConnectionProviderBuilder.getJpaConnectionProviderProperties( "db2" )
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
final Map<String, Object> properties = emf.getProperties();
|
||||||
|
|
||||||
|
final Object hibernateJdbcDriver = properties.get( AvailableSettings.URL );
|
||||||
|
assertThat( hibernateJdbcDriver, notNullValue() );
|
||||||
|
|
||||||
|
final Object jpaJdbcDriver = properties.get( AvailableSettings.JPA_JDBC_URL );
|
||||||
|
assertThat( (String) jpaJdbcDriver, containsString( "db2" ) );
|
||||||
|
|
||||||
|
// see if the values had the affect to adjust the `ConnectionProvider` used
|
||||||
|
final ConnectionProvider connectionProvider = emf.unwrap( SessionFactoryImplementor.class )
|
||||||
|
.getServiceRegistry()
|
||||||
|
.getService( ConnectionProvider.class );
|
||||||
|
assertThat( connectionProvider, instanceOf( DriverManagerConnectionProviderImpl.class ) );
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
emf.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@FailureExpected(
|
||||||
|
jiraKey = "HHH-12858",
|
||||||
|
message = "Even though the JDBC settings override a DataSource *property*, it" +
|
||||||
|
" does not override a DataSource defined using the dedicated persistence.xml element"
|
||||||
|
)
|
||||||
|
public void testPassingIntegrationJpaJdbcOverridesForJtaDataSourceElement() {
|
||||||
|
PersistenceProvider provider = new HibernatePersistenceProvider() {
|
||||||
|
@Override
|
||||||
|
public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map integrationOverrides) {
|
||||||
|
return super.createContainerEntityManagerFactory(
|
||||||
|
new DelegatingPersistenceUnitInfo( info ) {
|
||||||
|
// inject a JPA JTA DataSource setting into the PU
|
||||||
|
final DataSource puDataSource;
|
||||||
|
|
||||||
|
{
|
||||||
|
puDataSource = new DataSourceImpl( "puDataSource" );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataSource getJtaDataSource() {
|
||||||
|
return puDataSource;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
integrationOverrides
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
final EntityManagerFactory emf = provider.createContainerEntityManagerFactory(
|
||||||
|
new PersistenceUnitInfoAdapter(),
|
||||||
|
// however, provide JPA connection settings as "integration settings", which according to JPA spec should override the persistence unit values.
|
||||||
|
// - note that it is unclear in the spec whether JDBC value in the integration settings should override
|
||||||
|
// a JTA DataSource (nor the reverse). However, that is a useful thing to support
|
||||||
|
ConnectionProviderBuilder.getJpaConnectionProviderProperties( "db2" )
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
final Map<String, Object> properties = emf.getProperties();
|
||||||
|
|
||||||
|
final Object hibernateJdbcDriver = properties.get( AvailableSettings.URL );
|
||||||
|
assertThat( hibernateJdbcDriver, notNullValue() );
|
||||||
|
|
||||||
|
final Object jpaJdbcDriver = properties.get( AvailableSettings.JPA_JDBC_URL );
|
||||||
|
assertThat( (String) jpaJdbcDriver, containsString( "db2" ) );
|
||||||
|
|
||||||
|
// see if the values had the affect to adjust the `ConnectionProvider` used
|
||||||
|
final ConnectionProvider connectionProvider = emf.unwrap( SessionFactoryImplementor.class )
|
||||||
|
.getServiceRegistry()
|
||||||
|
.getService( ConnectionProvider.class );
|
||||||
|
assertThat( connectionProvider, instanceOf( DriverManagerConnectionProviderImpl.class ) );
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
emf.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@FailureExpected(
|
||||||
|
jiraKey = "HHH-12858",
|
||||||
|
message = "So it appears any use of the persistence.xml `jta-data-source` or `non-jta-data-source` " +
|
||||||
|
"have precedence over integration settings, which is also incorrect"
|
||||||
|
)
|
||||||
|
public void testPassingIntegrationJpaDataSourceOverrideForJtaDataSourceElement() {
|
||||||
|
final DataSource puDataSource = new DataSourceImpl( "puDataSource" );
|
||||||
|
final DataSource integrationDataSource = new DataSourceImpl( "integrationDataSource" );
|
||||||
|
|
||||||
|
PersistenceProvider provider = new HibernatePersistenceProvider() {
|
||||||
|
@Override
|
||||||
|
public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map integrationOverrides) {
|
||||||
|
return super.createContainerEntityManagerFactory(
|
||||||
|
new DelegatingPersistenceUnitInfo( info ) {
|
||||||
|
@Override
|
||||||
|
public DataSource getJtaDataSource() {
|
||||||
|
// pretend the DataSource was defined using the `jta-data-source` element in persistence.xml
|
||||||
|
// - as opposed using `javax.persistence.jtaDataSource` under the `properties` element
|
||||||
|
return puDataSource;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
integrationOverrides
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
final Map integrationOverrides = new HashMap();
|
||||||
|
//noinspection unchecked
|
||||||
|
integrationOverrides.put( AvailableSettings.JPA_JTA_DATASOURCE, integrationDataSource );
|
||||||
|
|
||||||
|
final EntityManagerFactory emf = provider.createContainerEntityManagerFactory(
|
||||||
|
new PersistenceUnitInfoAdapter(),
|
||||||
|
integrationOverrides
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
final Map<String, Object> properties = emf.getProperties();
|
||||||
|
|
||||||
|
final Object datasource = properties.get( AvailableSettings.JPA_JTA_DATASOURCE );
|
||||||
|
assertThat( datasource, is( integrationDataSource ) );
|
||||||
|
|
||||||
|
// see if the values had the affect to adjust the `ConnectionProvider` used
|
||||||
|
final ConnectionProvider connectionProvider = emf.unwrap( SessionFactoryImplementor.class )
|
||||||
|
.getServiceRegistry()
|
||||||
|
.getService( ConnectionProvider.class );
|
||||||
|
assertThat( connectionProvider, instanceOf( DatasourceConnectionProviderImpl.class ) );
|
||||||
|
|
||||||
|
final DatasourceConnectionProviderImpl datasourceConnectionProvider = (DatasourceConnectionProviderImpl) connectionProvider;
|
||||||
|
assertThat( datasourceConnectionProvider.getDataSource(), is( integrationDataSource ) );
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
emf.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@FailureExpected( jiraKey = "HHH-12858", message = "regression - fix" )
|
||||||
|
public void testIntegrationOverridesOfPersistenceXmlDataSource() {
|
||||||
|
|
||||||
|
// mimics a DataSource defined in the persistence.xml
|
||||||
|
final DataSourceImpl dataSource = new DataSourceImpl( "puDataSource" );
|
||||||
|
final PersistenceUnitInfoAdapter info = new PersistenceUnitInfoAdapter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataSource getNonJtaDataSource() {
|
||||||
|
return dataSource;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Now create "integration Map" that overrides the DataSource to use
|
||||||
|
final DataSource override = new DataSourceImpl( "integrationDataSource" );
|
||||||
|
final Map<String,Object> integrationSettings = new HashMap<>();
|
||||||
|
integrationSettings.put( AvailableSettings.JPA_NON_JTA_DATASOURCE, override );
|
||||||
|
|
||||||
|
final PersistenceProvider provider = new HibernatePersistenceProvider();
|
||||||
|
|
||||||
|
final EntityManagerFactory emf = provider.createContainerEntityManagerFactory(
|
||||||
|
info,
|
||||||
|
integrationSettings
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
final Map<String, Object> properties = emf.getProperties();
|
||||||
|
|
||||||
|
assertThat( properties.get( AvailableSettings.JPA_NON_JTA_DATASOURCE ), notNullValue() );
|
||||||
|
assertThat( properties.get( AvailableSettings.JPA_NON_JTA_DATASOURCE ), is( override ) );
|
||||||
|
|
||||||
|
final SessionFactoryImplementor sessionFactory = emf.unwrap( SessionFactoryImplementor.class );
|
||||||
|
final ConnectionProvider connectionProvider = sessionFactory.getServiceRegistry().getService( ConnectionProvider.class );
|
||||||
|
assertThat( connectionProvider, instanceOf( DatasourceConnectionProviderImpl.class ) );
|
||||||
|
|
||||||
|
final DatasourceConnectionProviderImpl dsProvider = (DatasourceConnectionProviderImpl) connectionProvider;
|
||||||
|
assertThat( dsProvider.getDataSource(), is( override ) );
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
emf.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@FailureExpected( jiraKey = "HHH-12858", message = "regression - fix" )
|
||||||
|
public void testIntegrationOverridesOfPersistenceXmlDataSourceWithDriverManagerInfo() {
|
||||||
|
|
||||||
|
// mimics a DataSource defined in the persistence.xml
|
||||||
|
final DataSourceImpl dataSource = new DataSourceImpl( "puDataSource" );
|
||||||
|
final PersistenceUnitInfoAdapter info = new PersistenceUnitInfoAdapter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataSource getNonJtaDataSource() {
|
||||||
|
return dataSource;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
final Map<String,Object> integrationSettings = new HashMap<>();
|
||||||
|
integrationSettings.put( AvailableSettings.JPA_JDBC_DRIVER, ConnectionProviderBuilder.DRIVER );
|
||||||
|
integrationSettings.put( AvailableSettings.JPA_JDBC_URL, ConnectionProviderBuilder.URL );
|
||||||
|
integrationSettings.put( AvailableSettings.JPA_JDBC_USER, ConnectionProviderBuilder.USER );
|
||||||
|
integrationSettings.put( AvailableSettings.JPA_JDBC_PASSWORD, ConnectionProviderBuilder.PASS );
|
||||||
|
|
||||||
|
final PersistenceProvider provider = new HibernatePersistenceProvider();
|
||||||
|
|
||||||
|
final EntityManagerFactory emf = provider.createContainerEntityManagerFactory(
|
||||||
|
info,
|
||||||
|
integrationSettings
|
||||||
|
);
|
||||||
|
|
||||||
|
final SessionFactoryImplementor sessionFactory = emf.unwrap( SessionFactoryImplementor.class );
|
||||||
|
final ConnectionProvider connectionProvider = sessionFactory.getServiceRegistry().getService( ConnectionProvider.class );
|
||||||
|
assertThat( connectionProvider, instanceOf( DriverManagerConnectionProviderImpl.class ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class DataSourceImpl implements DataSource {
|
||||||
|
private final String id;
|
||||||
|
private final DriverManagerConnectionProviderImpl connectionProvider;
|
||||||
|
private PrintWriter printWriter;
|
||||||
|
|
||||||
|
DataSourceImpl(String id) {
|
||||||
|
this.id = id;
|
||||||
|
connectionProvider = new DriverManagerConnectionProviderImpl();
|
||||||
|
connectionProvider.configure( ConnectionProviderBuilder.getConnectionProviderProperties() );
|
||||||
|
|
||||||
|
printWriter = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Connection getConnection() throws SQLException {
|
||||||
|
return connectionProvider.getConnection();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Connection getConnection(String username, String password) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PrintWriter getLogWriter() {
|
||||||
|
return printWriter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLogWriter(PrintWriter out) {
|
||||||
|
this.printWriter = out;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLoginTimeout(int seconds) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getLoginTimeout() {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Logger getParentLogger() {
|
||||||
|
return Logger.getGlobal();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> T unwrap(Class<T> iface) {
|
||||||
|
//noinspection unchecked
|
||||||
|
return (T) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isWrapperFor(Class<?> iface) {
|
||||||
|
return iface.isAssignableFrom( getClass() );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "DataSourceImpl(" + id + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* 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.hibernate.orm.test.bootstrap;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.hibernate.cfg.AvailableSettings;
|
||||||
|
import org.hibernate.tool.schema.Action;
|
||||||
|
import org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.hamcrest.CoreMatchers.is;
|
||||||
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Steve Ebersole
|
||||||
|
*/
|
||||||
|
public class SchemaToolingAutoActionTests {
|
||||||
|
@Test
|
||||||
|
public void testLegacySettingAsAction() {
|
||||||
|
final Properties props = new Properties();
|
||||||
|
props.put( AvailableSettings.HBM2DDL_AUTO, Action.CREATE_DROP );
|
||||||
|
|
||||||
|
final SchemaManagementToolCoordinator.ActionGrouping actionGrouping = SchemaManagementToolCoordinator.ActionGrouping.interpret( props );
|
||||||
|
|
||||||
|
assertThat( actionGrouping.getDatabaseAction(), is( Action.CREATE_DROP ) );
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests for Hibernate bootstrapping Hibernate
|
||||||
|
*/
|
||||||
|
package org.hibernate.orm.test.bootstrap;
|
|
@ -6,25 +6,15 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.testing.env;
|
package org.hibernate.testing.env;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.lang.reflect.InvocationHandler;
|
import java.lang.reflect.InvocationHandler;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Proxy;
|
import java.lang.reflect.Proxy;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.SQLFeatureNotSupportedException;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import javassist.scopedpool.SoftValueHashMap;
|
|
||||||
|
|
||||||
import org.hibernate.annotations.common.reflection.ReflectionUtil;
|
|
||||||
import org.hibernate.cfg.Environment;
|
import org.hibernate.cfg.Environment;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
import org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl;
|
import org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl;
|
||||||
|
@ -38,27 +28,42 @@ import org.hibernate.testing.DialectCheck;
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"WeakerAccess", "unused"})
|
||||||
public class ConnectionProviderBuilder implements DialectCheck {
|
public class ConnectionProviderBuilder implements DialectCheck {
|
||||||
public static final String DRIVER = "org.h2.Driver";
|
public static final String DRIVER = "org.h2.Driver";
|
||||||
public static final String DATA_SOURCE = "org.h2.jdbcx.JdbcDataSource";
|
public static final String DATA_SOURCE = "org.h2.jdbcx.JdbcDataSource";
|
||||||
// public static final String URL = "jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1;MVCC=TRUE";
|
// public static final String URL = "jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1;MVCC=TRUE";
|
||||||
public static final String URL = "jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1";
|
public static final String URL_FORMAT = "jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1";
|
||||||
|
public static final String URL = URL_FORMAT;
|
||||||
public static final String USER = "sa";
|
public static final String USER = "sa";
|
||||||
public static final String PASS = "";
|
public static final String PASS = "";
|
||||||
|
|
||||||
public static Properties getConnectionProviderProperties(String dbName) {
|
public static Properties getConnectionProviderProperties(String dbName) {
|
||||||
Properties props = new Properties( null );
|
Properties props = new Properties( null );
|
||||||
props.put( Environment.DRIVER, DRIVER );
|
props.put( Environment.DRIVER, DRIVER );
|
||||||
props.put( Environment.URL, String.format( URL, dbName ) );
|
props.put( Environment.URL, String.format( URL_FORMAT, dbName ) );
|
||||||
props.put( Environment.USER, USER );
|
props.put( Environment.USER, USER );
|
||||||
props.put( Environment.PASS, PASS );
|
props.put( Environment.PASS, PASS );
|
||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Properties getJpaConnectionProviderProperties(String dbName) {
|
||||||
|
Properties props = new Properties( null );
|
||||||
|
props.put( Environment.JPA_JDBC_DRIVER, DRIVER );
|
||||||
|
props.put( Environment.JPA_JDBC_URL, String.format( URL_FORMAT, dbName ) );
|
||||||
|
props.put( Environment.JPA_JDBC_USER, USER );
|
||||||
|
props.put( Environment.JPA_JDBC_PASSWORD, PASS );
|
||||||
|
return props;
|
||||||
|
}
|
||||||
|
|
||||||
public static Properties getConnectionProviderProperties() {
|
public static Properties getConnectionProviderProperties() {
|
||||||
return getConnectionProviderProperties( "db1" );
|
return getConnectionProviderProperties( "db1" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Properties getJpaConnectionProviderProperties() {
|
||||||
|
return getJpaConnectionProviderProperties( "db1" );
|
||||||
|
}
|
||||||
|
|
||||||
public static DriverManagerConnectionProviderImpl buildConnectionProvider() {
|
public static DriverManagerConnectionProviderImpl buildConnectionProvider() {
|
||||||
return buildConnectionProvider( false );
|
return buildConnectionProvider( false );
|
||||||
}
|
}
|
||||||
|
@ -133,7 +138,7 @@ public class ConnectionProviderBuilder implements DialectCheck {
|
||||||
return connectionProxy;
|
return connectionProxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ConnectionInvocationHandler implements InvocationHandler {
|
private static class ConnectionInvocationHandler implements InvocationHandler {
|
||||||
|
|
||||||
private final Connection target;
|
private final Connection target;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,110 @@
|
||||||
|
/*
|
||||||
|
* 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.hibernate.testing.util.jpa;
|
||||||
|
|
||||||
|
import javax.persistence.SharedCacheMode;
|
||||||
|
import javax.persistence.ValidationMode;
|
||||||
|
import javax.persistence.spi.ClassTransformer;
|
||||||
|
import javax.persistence.spi.PersistenceUnitInfo;
|
||||||
|
import javax.persistence.spi.PersistenceUnitTransactionType;
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
public class DelegatingPersistenceUnitInfo implements PersistenceUnitInfo {
|
||||||
|
private final PersistenceUnitInfo delegate;
|
||||||
|
|
||||||
|
public DelegatingPersistenceUnitInfo(PersistenceUnitInfo delegate) {
|
||||||
|
this.delegate = delegate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPersistenceUnitName() {
|
||||||
|
return delegate.getPersistenceUnitName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPersistenceProviderClassName() {
|
||||||
|
return delegate.getPersistenceProviderClassName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PersistenceUnitTransactionType getTransactionType() {
|
||||||
|
return delegate.getTransactionType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataSource getJtaDataSource() {
|
||||||
|
return delegate.getJtaDataSource();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataSource getNonJtaDataSource() {
|
||||||
|
return delegate.getNonJtaDataSource();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getMappingFileNames() {
|
||||||
|
return delegate.getMappingFileNames();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<URL> getJarFileUrls() {
|
||||||
|
return delegate.getJarFileUrls();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public URL getPersistenceUnitRootUrl() {
|
||||||
|
return delegate.getPersistenceUnitRootUrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getManagedClassNames() {
|
||||||
|
return delegate.getManagedClassNames();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean excludeUnlistedClasses() {
|
||||||
|
return delegate.excludeUnlistedClasses();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SharedCacheMode getSharedCacheMode() {
|
||||||
|
return delegate.getSharedCacheMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ValidationMode getValidationMode() {
|
||||||
|
return delegate.getValidationMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Properties getProperties() {
|
||||||
|
return delegate.getProperties();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPersistenceXMLSchemaVersion() {
|
||||||
|
return delegate.getPersistenceXMLSchemaVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassLoader getClassLoader() {
|
||||||
|
return delegate.getClassLoader();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addTransformer(ClassTransformer transformer) {
|
||||||
|
delegate.addTransformer( transformer );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassLoader getNewTempClassLoader() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,117 @@
|
||||||
|
/*
|
||||||
|
* 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.hibernate.testing.util.jpa;
|
||||||
|
|
||||||
|
import javax.persistence.SharedCacheMode;
|
||||||
|
import javax.persistence.ValidationMode;
|
||||||
|
import javax.persistence.spi.ClassTransformer;
|
||||||
|
import javax.persistence.spi.PersistenceUnitInfo;
|
||||||
|
import javax.persistence.spi.PersistenceUnitTransactionType;
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.hibernate.jpa.HibernatePersistenceProvider;
|
||||||
|
|
||||||
|
public class PersistenceUnitInfoAdapter implements PersistenceUnitInfo {
|
||||||
|
private final Properties properties;
|
||||||
|
|
||||||
|
public PersistenceUnitInfoAdapter() {
|
||||||
|
this( new Properties() );
|
||||||
|
}
|
||||||
|
|
||||||
|
public PersistenceUnitInfoAdapter(Properties properties) {
|
||||||
|
this.properties = properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPersistenceUnitName() {
|
||||||
|
return "pu";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPersistenceProviderClassName() {
|
||||||
|
return HibernatePersistenceProvider.class.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PersistenceUnitTransactionType getTransactionType() {
|
||||||
|
return PersistenceUnitTransactionType.RESOURCE_LOCAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataSource getJtaDataSource() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataSource getNonJtaDataSource() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getMappingFileNames() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<URL> getJarFileUrls() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public URL getPersistenceUnitRootUrl() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getManagedClassNames() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean excludeUnlistedClasses() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SharedCacheMode getSharedCacheMode() {
|
||||||
|
return SharedCacheMode.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ValidationMode getValidationMode() {
|
||||||
|
return ValidationMode.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Properties getProperties() {
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPersistenceXMLSchemaVersion() {
|
||||||
|
return "2.1";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassLoader getClassLoader() {
|
||||||
|
return PersistenceUnitInfoAdapter.class.getClassLoader();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addTransformer(ClassTransformer transformer) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassLoader getNewTempClassLoader() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,130 @@
|
||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
|
* indicated by the @author tags or express copyright attribution
|
||||||
|
* statements applied by the authors. All third-party contributions are
|
||||||
|
* distributed under license by Red Hat Inc.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
* Lesser General Public License, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program 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 distribution; if not, write to:
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
|
* 51 Franklin Street, Fifth Floor
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.hibernate.testing.util.jpa;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
import javax.persistence.SharedCacheMode;
|
||||||
|
import javax.persistence.ValidationMode;
|
||||||
|
import javax.persistence.spi.ClassTransformer;
|
||||||
|
import javax.persistence.spi.PersistenceUnitInfo;
|
||||||
|
import javax.persistence.spi.PersistenceUnitTransactionType;
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
import org.hibernate.jpa.HibernatePersistenceProvider;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO : javadoc
|
||||||
|
*
|
||||||
|
* @author Steve Ebersole
|
||||||
|
*/
|
||||||
|
public class PersistenceUnitInfoPropertiesWrapper implements PersistenceUnitInfo {
|
||||||
|
private Properties properties;
|
||||||
|
|
||||||
|
public PersistenceUnitInfoPropertiesWrapper() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public PersistenceUnitInfoPropertiesWrapper(Properties properties) {
|
||||||
|
this.properties = properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPersistenceUnitName() {
|
||||||
|
return "persistenceUnitAdapter";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPersistenceProviderClassName() {
|
||||||
|
return HibernatePersistenceProvider.class.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PersistenceUnitTransactionType getTransactionType() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataSource getJtaDataSource() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataSource getNonJtaDataSource() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getMappingFileNames() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<URL> getJarFileUrls() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public URL getPersistenceUnitRootUrl() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getManagedClassNames() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean excludeUnlistedClasses() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SharedCacheMode getSharedCacheMode() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ValidationMode getValidationMode() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Properties getProperties() {
|
||||||
|
if ( properties == null ) {
|
||||||
|
properties = new Properties();
|
||||||
|
}
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPersistenceXMLSchemaVersion() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClassLoader getClassLoader() {
|
||||||
|
return Thread.currentThread().getContextClassLoader();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addTransformer(ClassTransformer transformer) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClassLoader getNewTempClassLoader() {
|
||||||
|
return Thread.currentThread().getContextClassLoader();
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,36 +6,11 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.orm.tooling.gradle;
|
package org.hibernate.orm.tooling.gradle;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.net.URLClassLoader;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.gradle.api.Action;
|
|
||||||
import org.gradle.api.GradleException;
|
|
||||||
import org.gradle.api.Plugin;
|
import org.gradle.api.Plugin;
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
import org.gradle.api.Task;
|
import org.gradle.api.Task;
|
||||||
import org.gradle.api.file.FileCollection;
|
|
||||||
import org.gradle.api.file.FileTree;
|
|
||||||
import org.gradle.api.logging.Logger;
|
|
||||||
import org.gradle.api.logging.Logging;
|
|
||||||
import org.gradle.api.tasks.SourceSet;
|
import org.gradle.api.tasks.SourceSet;
|
||||||
|
|
||||||
import org.hibernate.bytecode.enhance.spi.DefaultEnhancementContext;
|
|
||||||
import org.hibernate.bytecode.enhance.spi.EnhancementContext;
|
|
||||||
import org.hibernate.bytecode.enhance.spi.Enhancer;
|
|
||||||
import org.hibernate.bytecode.enhance.spi.UnloadedClass;
|
|
||||||
import org.hibernate.bytecode.enhance.spi.UnloadedField;
|
|
||||||
import org.hibernate.cfg.Environment;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Hibernate Gradle plugin. Adds Hibernate build-time capabilities into your Gradle-based build.
|
* The Hibernate Gradle plugin. Adds Hibernate build-time capabilities into your Gradle-based build.
|
||||||
*
|
*
|
||||||
|
@ -44,8 +19,6 @@ import org.hibernate.cfg.Environment;
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class HibernatePlugin implements Plugin<Project> {
|
public class HibernatePlugin implements Plugin<Project> {
|
||||||
private final Logger logger = Logging.getLogger( HibernatePlugin.class );
|
|
||||||
|
|
||||||
public void apply(Project project) {
|
public void apply(Project project) {
|
||||||
project.getPlugins().apply( "java" );
|
project.getPlugins().apply( "java" );
|
||||||
|
|
||||||
|
@ -55,16 +28,12 @@ public class HibernatePlugin implements Plugin<Project> {
|
||||||
project.getExtensions().add( "hibernate", hibernateExtension );
|
project.getExtensions().add( "hibernate", hibernateExtension );
|
||||||
|
|
||||||
project.afterEvaluate(
|
project.afterEvaluate(
|
||||||
project1 -> {
|
p -> applyEnhancement( p, hibernateExtension )
|
||||||
if ( hibernateExtension.enhance != null ) {
|
|
||||||
applyEnhancement( project1, hibernateExtension );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyEnhancement(final Project project, final HibernateExtension hibernateExtension) {
|
private void applyEnhancement(final Project project, final HibernateExtension hibernateExtension) {
|
||||||
if ( !hibernateExtension.enhance.shouldApply() ) {
|
if ( hibernateExtension.enhance == null || ! hibernateExtension.enhance.shouldApply() ) {
|
||||||
project.getLogger().warn( "Skipping Hibernate bytecode enhancement since no feature is enabled" );
|
project.getLogger().warn( "Skipping Hibernate bytecode enhancement since no feature is enabled" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue