Merge remote-tracking branch 'upstream/master' into wip/6.0
This commit is contained in:
commit
4d8c89920a
|
@ -4,6 +4,4 @@
|
|||
* 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>.
|
||||
*/
|
||||
// Expected to match the jar name: drop a copy of ojdbc8.jar in a local directory,
|
||||
// then point the environment variable ADDITIONAL_REPO to that directory.
|
||||
jdbcDependency name : 'ojdbc8'
|
||||
jdbcDependency 'com.oracle.database.jdbc:ojdbc8:19.8.0.0'
|
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
|
||||
hibernate.dialect org.hibernate.dialect.Oracle12cDialect
|
||||
hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
|
||||
hibernate.connection.driver_class oracle.jdbc.OracleDriver
|
||||
hibernate.connection.url jdbc:oracle:thin:@hibernate-testing-oracle-se.ccuzkqo3zqzq.us-east-1.rds.amazonaws.com:1521:ORCL
|
||||
hibernate.connection.username hibernate_orm_test
|
||||
hibernate.connection.password hibernate_orm_test
|
||||
|
|
|
@ -69,7 +69,7 @@ hibernate.connection.url jdbc:hsqldb:./build/db/hsqldb/hibernate
|
|||
#hibernate.dialect org.hibernate.dialect.Oracle8iDialect
|
||||
#hibernate.dialect org.hibernate.dialect.Oracle9iDialect
|
||||
#hibernate.dialect org.hibernate.dialect.Oracle10gDialect
|
||||
#hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
|
||||
#hibernate.connection.driver_class oracle.jdbc.OracleDriver
|
||||
#hibernate.connection.username ora
|
||||
#hibernate.connection.password ora
|
||||
#hibernate.connection.url jdbc:oracle:thin:@localhost:1521:orcl
|
||||
|
|
|
@ -54,7 +54,7 @@ hibernate.connection.url @DB_URL@
|
|||
|
||||
#hibernate.dialect org.hibernate.dialect.OracleDialect
|
||||
#hibernate.dialect org.hibernate.dialect.Oracle9Dialect
|
||||
#hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
|
||||
#hibernate.connection.driver_class oracle.jdbc.OracleDriver
|
||||
#hibernate.connection.username ora
|
||||
#hibernate.connection.password ora
|
||||
#hibernate.connection.url jdbc:oracle:thin:@localhost:1521:test
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
# Keep system properties in sync with test system properties (java-module.gradle)!
|
||||
org.gradle.jvmargs=-Xmx1g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Duser.language=en -Duser.country=US -Duser.timezone=UTC -Dfile.encoding=UTF-8
|
||||
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -Duser.language=en -Duser.country=US -Duser.timezone=UTC -Dfile.encoding=UTF-8
|
||||
|
|
|
@ -76,11 +76,21 @@ ext {
|
|||
],
|
||||
oracle : [
|
||||
'db.dialect' : 'org.hibernate.dialect.Oracle10gDialect',
|
||||
'jdbc.driver': 'oracle.jdbc.driver.OracleDriver',
|
||||
'jdbc.driver': 'oracle.jdbc.OracleDriver',
|
||||
'jdbc.user' : 'hibernate_orm_test',
|
||||
'jdbc.pass' : 'hibernate_orm_test',
|
||||
'jdbc.url' : 'jdbc:oracle:thin:@localhost:1521/xe'
|
||||
],
|
||||
// Uses the default settings for using https://hub.docker.com/_/oracle-database-enterprise-edition
|
||||
// After registering to get access (see instructions at above link), start it for testing with:
|
||||
// docker run --ulimit memlock=-1:-1 -it --rm=true --memory-swappiness=0 --name ORCLCDB -p 1521:1521 store/oracle/database-enterprise:12.2.0.1-slim
|
||||
oracle_docker : [
|
||||
'db.dialect' : 'org.hibernate.dialect.Oracle12cDialect',
|
||||
'jdbc.driver': 'oracle.jdbc.OracleDriver',
|
||||
'jdbc.user' : 'sys as sysdba',
|
||||
'jdbc.pass' : 'Oradoc_db1',
|
||||
'jdbc.url' : 'jdbc:oracle:thin:@localhost:1521:ORCLCDB'
|
||||
],
|
||||
mssql : [
|
||||
'db.dialect' : 'org.hibernate.dialect.SQLServer2012Dialect',
|
||||
'jdbc.driver': 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
|
||||
|
|
|
@ -23,6 +23,10 @@ buildscript {
|
|||
import de.thetaphi.forbiddenapis.gradle.CheckForbiddenApis
|
||||
import org.apache.tools.ant.filters.ReplaceTokens
|
||||
|
||||
/**
|
||||
* Support for modules that contain Java code
|
||||
*/
|
||||
|
||||
apply from: rootProject.file( 'gradle/base-information.gradle' )
|
||||
apply from: rootProject.file( 'gradle/libraries.gradle' )
|
||||
apply from: rootProject.file( 'gradle/databases.gradle' )
|
||||
|
@ -107,10 +111,8 @@ dependencies {
|
|||
testRuntime( libraries.hana )
|
||||
testRuntime( libraries.cockroachdb )
|
||||
|
||||
if ( db.equalsIgnoreCase( 'oracle' ) ) {
|
||||
testRuntime( libraries.oracle ) {
|
||||
exclude group: 'com.oracle.jdbc', module: 'xmlparserv2'
|
||||
}
|
||||
if ( db.equalsIgnoreCase( 'oracle' ) || db.equalsIgnoreCase( 'oracle_docker' ) ) {
|
||||
testRuntime( libraries.oracle )
|
||||
}
|
||||
else if ( db.equalsIgnoreCase( 'db2' ) ) {
|
||||
testRuntime( libraries.db2 )
|
||||
|
@ -196,10 +198,10 @@ tasks.withType( Test.class ).each { test ->
|
|||
test.jvmArgs += [
|
||||
'-XX:+HeapDumpOnOutOfMemoryError',
|
||||
"-XX:HeapDumpPath=${file( "${buildDir}/OOM-dump.hprof" ).absolutePath}",
|
||||
'-XX:MetaspaceSize=512M'
|
||||
'-XX:MetaspaceSize=256M'
|
||||
]
|
||||
|
||||
test.maxHeapSize = '4G'
|
||||
test.maxHeapSize = '3G'
|
||||
|
||||
test.systemProperties['hibernate.test.validatefailureexpected'] = true
|
||||
test.systemProperties += System.properties.findAll { it.key.startsWith( "hibernate." ) }
|
||||
|
|
|
@ -17,7 +17,7 @@ ext {
|
|||
bytemanVersion = '4.0.13' //Compatible with JDK16
|
||||
jnpVersion = '5.0.6.CR1'
|
||||
|
||||
hibernateCommonsVersion = '5.1.0.Final'
|
||||
hibernateCommonsVersion = '5.1.1.Final'
|
||||
hibernateValidatorVersion = '6.1.5.Final'
|
||||
validationApiVersion = '2.0.1.Final'
|
||||
elVersion = '3.0.1-b09'
|
||||
|
@ -129,7 +129,7 @@ ext {
|
|||
mariadb: 'org.mariadb.jdbc:mariadb-java-client:2.2.3',
|
||||
cockroachdb: 'org.postgresql:postgresql:42.2.8',
|
||||
|
||||
oracle: 'com.oracle.jdbc:ojdbc8:12.2.0.1',
|
||||
oracle: 'com.oracle.database.jdbc:ojdbc8:19.8.0.0',
|
||||
mssql: 'com.microsoft.sqlserver:mssql-jdbc:7.2.1.jre8',
|
||||
db2: 'com.ibm.db2:db2jcc:10.5',
|
||||
hana: 'com.sap.cloud.db.jdbc:ngdbc:2.4.59',
|
||||
|
|
|
@ -25,9 +25,7 @@ dependencies {
|
|||
testRuntime( libraries.expression_language )
|
||||
|
||||
if ( db.equalsIgnoreCase( 'oracle' ) ) {
|
||||
testRuntime( libraries.oracle ) {
|
||||
exclude group: 'com.oracle.jdbc', module: 'xmlparserv2'
|
||||
}
|
||||
testRuntime( libraries.oracle )
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,11 +13,9 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.annotations.common.reflection.ClassLoaderDelegate;
|
||||
import org.hibernate.annotations.common.reflection.ClassLoadingException;
|
||||
import org.hibernate.annotations.common.reflection.ReflectionManager;
|
||||
import org.hibernate.annotations.common.reflection.java.JavaReflectionManager;
|
||||
import org.hibernate.annotations.common.util.StandardClassLoaderDelegateImpl;
|
||||
import org.hibernate.boot.AttributeConverterInfo;
|
||||
import org.hibernate.boot.CacheRegionDefinition;
|
||||
import org.hibernate.boot.archive.scan.internal.StandardScanOptions;
|
||||
import org.hibernate.boot.archive.scan.spi.ScanEnvironment;
|
||||
|
@ -322,32 +320,7 @@ public class BootstrapContextImpl implements BootstrapContext {
|
|||
private JavaReflectionManager generateHcannReflectionManager() {
|
||||
final JavaReflectionManager reflectionManager = new JavaReflectionManager();
|
||||
reflectionManager.setMetadataProvider( new JPAMetadataProvider( this ) );
|
||||
reflectionManager.injectClassLoaderDelegate( generateHcannClassLoaderDelegate() );
|
||||
return reflectionManager;
|
||||
}
|
||||
|
||||
private ClassLoaderDelegate generateHcannClassLoaderDelegate() {
|
||||
// class loading here needs to be drastically different for 7.0
|
||||
// but luckily 7.0 will do away with HCANN use and be easier to
|
||||
// implement this.
|
||||
//
|
||||
// todo (6.0) : *if possible* make similar change in 6.0
|
||||
// possibly using the JPA temp class loader or create our own "throw awy" ClassLoader;
|
||||
// the trouble there is that we eventually need to load the Class into the real
|
||||
// ClassLoader prior to use
|
||||
|
||||
final ClassLoaderService classLoaderService = getServiceRegistry().getService( ClassLoaderService.class );
|
||||
|
||||
return new ClassLoaderDelegate() {
|
||||
@Override
|
||||
public <T> Class<T> classForName(String className) throws ClassLoadingException {
|
||||
try {
|
||||
return classLoaderService.classForName( className );
|
||||
}
|
||||
catch (org.hibernate.boot.registry.classloading.spi.ClassLoadingException e) {
|
||||
return StandardClassLoaderDelegateImpl.INSTANCE.classForName( className );
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,6 @@ import javax.persistence.Embeddable;
|
|||
import javax.persistence.Entity;
|
||||
import javax.persistence.MappedSuperclass;
|
||||
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.annotations.common.reflection.ClassLoadingException;
|
||||
import org.hibernate.annotations.common.reflection.MetadataProviderInjector;
|
||||
import org.hibernate.annotations.common.reflection.ReflectionManager;
|
||||
import org.hibernate.annotations.common.reflection.XClass;
|
||||
|
@ -59,6 +57,7 @@ public class AnnotationMetadataSourceProcessorImpl implements MetadataSourceProc
|
|||
private final LinkedHashSet<String> annotatedPackages = new LinkedHashSet<>();
|
||||
|
||||
private final List<XClass> xClasses = new ArrayList<>();
|
||||
private final ClassLoaderService classLoaderService;
|
||||
|
||||
public AnnotationMetadataSourceProcessorImpl(
|
||||
ManagedResources managedResources,
|
||||
|
@ -74,6 +73,7 @@ public class AnnotationMetadataSourceProcessorImpl implements MetadataSourceProc
|
|||
}
|
||||
|
||||
final AttributeConverterManager attributeConverterManager = new AttributeConverterManager( rootMetadataBuildingContext );
|
||||
this.classLoaderService = rootMetadataBuildingContext.getBuildingOptions().getServiceRegistry().getService( ClassLoaderService.class );
|
||||
|
||||
if ( rootMetadataBuildingContext.getBuildingOptions().isXmlMappingEnabled() ) {
|
||||
|
||||
|
@ -97,25 +97,24 @@ public class AnnotationMetadataSourceProcessorImpl implements MetadataSourceProc
|
|||
|
||||
final List<String> classNames = jpaMetadataProvider.getXMLContext().addDocument( dom4jDocument );
|
||||
for ( String className : classNames ) {
|
||||
xClasses.add( toXClass( className, reflectionManager ) );
|
||||
xClasses.add( toXClass( className, reflectionManager, classLoaderService ) );
|
||||
}
|
||||
}
|
||||
jpaMetadataProvider.getXMLContext().applyDiscoveredAttributeConverters( attributeConverterManager );
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
|
||||
final ClassLoaderService cls = rootMetadataBuildingContext.getBuildingOptions().getServiceRegistry().getService( ClassLoaderService.class );
|
||||
for ( String className : managedResources.getAnnotatedClassNames() ) {
|
||||
final Class annotatedClass = cls.classForName( className );
|
||||
categorizeAnnotatedClass( annotatedClass, attributeConverterManager );
|
||||
final Class annotatedClass = classLoaderService.classForName( className );
|
||||
categorizeAnnotatedClass( annotatedClass, attributeConverterManager, classLoaderService );
|
||||
}
|
||||
|
||||
for ( Class annotatedClass : managedResources.getAnnotatedClassReferences() ) {
|
||||
categorizeAnnotatedClass( annotatedClass, attributeConverterManager );
|
||||
categorizeAnnotatedClass( annotatedClass, attributeConverterManager, classLoaderService );
|
||||
}
|
||||
}
|
||||
|
||||
private void categorizeAnnotatedClass(Class annotatedClass, AttributeConverterManager attributeConverterManager) {
|
||||
private void categorizeAnnotatedClass(Class annotatedClass, AttributeConverterManager attributeConverterManager, ClassLoaderService cls) {
|
||||
final XClass xClass = reflectionManager.toXClass( annotatedClass );
|
||||
// categorize it, based on assumption it does not fall into multiple categories
|
||||
if ( xClass.isAnnotationPresent( Converter.class ) ) {
|
||||
|
@ -135,13 +134,8 @@ public class AnnotationMetadataSourceProcessorImpl implements MetadataSourceProc
|
|||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private XClass toXClass(String className, ReflectionManager reflectionManager) {
|
||||
try {
|
||||
return reflectionManager.classForName( className );
|
||||
}
|
||||
catch ( ClassLoadingException e ) {
|
||||
throw new AnnotationException( "Unable to load class defined in XML: " + className, e );
|
||||
}
|
||||
private XClass toXClass(String className, ReflectionManager reflectionManager, ClassLoaderService cls) {
|
||||
return reflectionManager.toXClass( cls.classForName( className ) );
|
||||
}
|
||||
|
||||
// private Document toDom4jDocument(MappingBinder.DelayedOrmXmlData delayedOrmXmlData) {
|
||||
|
@ -192,7 +186,7 @@ public class AnnotationMetadataSourceProcessorImpl implements MetadataSourceProc
|
|||
|
||||
AnnotationBinder.bindDefaults( rootMetadataBuildingContext );
|
||||
for ( String annotatedPackage : annotatedPackages ) {
|
||||
AnnotationBinder.bindPackage( annotatedPackage, rootMetadataBuildingContext );
|
||||
AnnotationBinder.bindPackage( classLoaderService, annotatedPackage, rootMetadataBuildingContext );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -303,7 +297,7 @@ public class AnnotationMetadataSourceProcessorImpl implements MetadataSourceProc
|
|||
@Override
|
||||
public void postProcessEntityHierarchies() {
|
||||
for ( String annotatedPackage : annotatedPackages ) {
|
||||
AnnotationBinder.bindFetchProfilesForPackage( annotatedPackage, rootMetadataBuildingContext );
|
||||
AnnotationBinder.bindFetchProfilesForPackage( classLoaderService, annotatedPackage, rootMetadataBuildingContext );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -261,6 +261,22 @@ public class ClassLoaderServiceImpl implements ClassLoaderService {
|
|||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Package packageForNameOrNull(String packageName) {
|
||||
try {
|
||||
Class<?> aClass = Class.forName( packageName + ".package-info", true, getAggregatedClassLoader() );
|
||||
return aClass == null ? null : aClass.getPackage();
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
log.packageNotFound( packageName );
|
||||
return null;
|
||||
}
|
||||
catch (LinkageError e) {
|
||||
log.warn( "LinkageError while attempting to load Package named " + packageName, e );
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T workWithClassLoader(Work<T> work) {
|
||||
return work.doWork( getAggregatedClassLoader() );
|
||||
|
|
|
@ -75,6 +75,21 @@ public interface ClassLoaderService extends Service, Stoppable {
|
|||
|
||||
<T> T generateProxy(InvocationHandler handler, Class... interfaces);
|
||||
|
||||
/**
|
||||
* Loading a Package from the classloader. In case it's not found or an
|
||||
* internal error (such as @see {@link LinkageError} occurs, we
|
||||
* return null rather than throwing an exception.
|
||||
* This is significantly different than loading a Class, as in all
|
||||
* currently known usages, being unable to load the Package will
|
||||
* only result in ignoring annotations on it - which is totally
|
||||
* fine when the object doesn't exist.
|
||||
* In case of other errors, implementations are expected to log
|
||||
* a warning but it's still not treated as a fatal error.
|
||||
* @param packageName
|
||||
* @return the matching Package, or null.
|
||||
*/
|
||||
Package packageForNameOrNull(String packageName);
|
||||
|
||||
interface Work<T> {
|
||||
T doWork(ClassLoader classLoader);
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ import org.hibernate.annotations.Tuplizers;
|
|||
import org.hibernate.annotations.TypeDef;
|
||||
import org.hibernate.annotations.TypeDefs;
|
||||
import org.hibernate.annotations.Where;
|
||||
import org.hibernate.annotations.common.reflection.ClassLoadingException;
|
||||
import org.hibernate.annotations.common.reflection.ReflectionManager;
|
||||
import org.hibernate.annotations.common.reflection.XAnnotatedElement;
|
||||
import org.hibernate.annotations.common.reflection.XClass;
|
||||
import org.hibernate.annotations.common.reflection.XMethod;
|
||||
|
@ -136,6 +136,7 @@ import org.hibernate.annotations.common.reflection.XProperty;
|
|||
import org.hibernate.boot.model.IdGeneratorStrategyInterpreter;
|
||||
import org.hibernate.boot.model.IdentifierGeneratorDefinition;
|
||||
import org.hibernate.boot.model.TypeDefinition;
|
||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||
import org.hibernate.boot.spi.InFlightMetadataCollector;
|
||||
import org.hibernate.boot.spi.InFlightMetadataCollector.EntityTableXref;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
|
@ -150,8 +151,6 @@ import org.hibernate.cfg.annotations.PropertyBinder;
|
|||
import org.hibernate.cfg.annotations.QueryBinder;
|
||||
import org.hibernate.cfg.annotations.TableBinder;
|
||||
import org.hibernate.engine.OptimisticLockStyle;
|
||||
import org.hibernate.engine.config.spi.ConfigurationService;
|
||||
import org.hibernate.engine.config.spi.StandardConverters;
|
||||
import org.hibernate.engine.spi.FilterDefinition;
|
||||
import org.hibernate.id.PersistentIdentifierGenerator;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
|
@ -314,19 +313,12 @@ public final class AnnotationBinder {
|
|||
}
|
||||
}
|
||||
|
||||
public static void bindPackage(String packageName, MetadataBuildingContext context) {
|
||||
XPackage pckg;
|
||||
try {
|
||||
pckg = context.getBootstrapContext().getReflectionManager().packageForName( packageName );
|
||||
}
|
||||
catch (ClassLoadingException e) {
|
||||
LOG.packageNotFound( packageName );
|
||||
return;
|
||||
}
|
||||
catch ( ClassNotFoundException cnf ) {
|
||||
LOG.packageNotFound( packageName );
|
||||
public static void bindPackage(ClassLoaderService cls, String packageName, MetadataBuildingContext context) {
|
||||
final Package packaze = cls.packageForNameOrNull( packageName );
|
||||
if ( packaze == null ) {
|
||||
return;
|
||||
}
|
||||
final XPackage pckg = context.getBootstrapContext().getReflectionManager().toXPackage( packaze );
|
||||
|
||||
if ( pckg.isAnnotationPresent( SequenceGenerator.class ) ) {
|
||||
SequenceGenerator ann = pckg.getAnnotation( SequenceGenerator.class );
|
||||
|
@ -1507,20 +1499,13 @@ public final class AnnotationBinder {
|
|||
bindFetchProfiles( clazzToProcess, context );
|
||||
}
|
||||
|
||||
public static void bindFetchProfilesForPackage(String packageName, MetadataBuildingContext context) {
|
||||
XPackage pckg;
|
||||
try {
|
||||
pckg = context.getBootstrapContext().getReflectionManager().packageForName( packageName );
|
||||
}
|
||||
catch (ClassLoadingException e) {
|
||||
LOG.packageNotFound( packageName );
|
||||
public static void bindFetchProfilesForPackage(ClassLoaderService cls, String packageName, MetadataBuildingContext context) {
|
||||
final Package packaze = cls.packageForNameOrNull( packageName );
|
||||
if ( packaze == null ) {
|
||||
return;
|
||||
}
|
||||
catch ( ClassNotFoundException cnf ) {
|
||||
LOG.packageNotFound( packageName );
|
||||
return;
|
||||
}
|
||||
|
||||
final ReflectionManager reflectionManager = context.getBootstrapContext().getReflectionManager();
|
||||
final XPackage pckg = reflectionManager.toXPackage( packaze );
|
||||
bindFetchProfiles( pckg, context );
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.hibernate.annotations.AnyMetaDef;
|
|||
import org.hibernate.annotations.AnyMetaDefs;
|
||||
import org.hibernate.annotations.MetaValue;
|
||||
import org.hibernate.annotations.SqlFragmentAlias;
|
||||
import org.hibernate.annotations.common.reflection.ClassLoadingException;
|
||||
import org.hibernate.annotations.common.reflection.XAnnotatedElement;
|
||||
import org.hibernate.annotations.common.reflection.XClass;
|
||||
import org.hibernate.annotations.common.reflection.XPackage;
|
||||
|
@ -1111,14 +1110,8 @@ public class BinderHelper {
|
|||
PropertyHolder propertyHolder,
|
||||
String propertyName,
|
||||
MetadataBuildingContext buildingContext) {
|
||||
final XClass persistentXClass;
|
||||
try {
|
||||
persistentXClass = buildingContext.getBootstrapContext().getReflectionManager()
|
||||
.classForName( propertyHolder.getPersistentClass().getClassName() );
|
||||
}
|
||||
catch ( ClassLoadingException e ) {
|
||||
throw new AssertionFailure( "PersistentClass name cannot be converted into a Class", e);
|
||||
}
|
||||
final XClass persistentXClass = buildingContext.getBootstrapContext().getReflectionManager()
|
||||
.toXClass( propertyHolder.getPersistentClass().getMappedClass() );
|
||||
if ( propertyHolder.isInIdClass() ) {
|
||||
PropertyData pd = buildingContext.getMetadataCollector().getPropertyAnnotatedWithIdAndToOne(
|
||||
persistentXClass,
|
||||
|
|
|
@ -6,12 +6,8 @@
|
|||
*/
|
||||
package org.hibernate.cfg.annotations;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Member;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.annotations.common.reflection.XProperty;
|
||||
import org.hibernate.annotations.common.reflection.java.JavaXMember;
|
||||
|
||||
|
@ -20,47 +16,35 @@ import org.hibernate.annotations.common.reflection.java.JavaXMember;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class HCANNHelper {
|
||||
private static Method getMemberMethod;
|
||||
static {
|
||||
// The following is in a static block to avoid problems lazy-initializing
|
||||
// and making accessible in a multi-threaded context. See HHH-11289.
|
||||
final Class<?> javaXMemberClass = JavaXMember.class;
|
||||
try {
|
||||
getMemberMethod = javaXMemberClass.getDeclaredMethod( "getMember" );
|
||||
// NOTE : no need to check accessibility here - we know it is protected
|
||||
getMemberMethod.setAccessible( true );
|
||||
}
|
||||
catch (NoSuchMethodException e) {
|
||||
throw new AssertionFailure(
|
||||
"Could not resolve JavaXMember#getMember method in order to access XProperty member signature",
|
||||
e
|
||||
);
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new HibernateException( "Could not access org.hibernate.annotations.common.reflection.java.JavaXMember#getMember method", e );
|
||||
}
|
||||
}
|
||||
public final class HCANNHelper {
|
||||
|
||||
/**
|
||||
* @deprecated Prefer using {@link #annotatedElementSignature(JavaXMember)}
|
||||
*/
|
||||
@Deprecated
|
||||
public static String annotatedElementSignature(XProperty xProperty) {
|
||||
return getUnderlyingMember( xProperty ).toString();
|
||||
}
|
||||
|
||||
public static String annotatedElementSignature(final JavaXMember jxProperty) {
|
||||
return getUnderlyingMember( jxProperty ).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Prefer using {@link #getUnderlyingMember(JavaXMember)}
|
||||
*/
|
||||
@Deprecated
|
||||
public static Member getUnderlyingMember(XProperty xProperty) {
|
||||
try {
|
||||
return (Member) getMemberMethod.invoke( xProperty );
|
||||
if (xProperty instanceof JavaXMember) {
|
||||
JavaXMember jx = (JavaXMember)xProperty;
|
||||
return jx.getMember();
|
||||
}
|
||||
catch (IllegalAccessException e) {
|
||||
throw new AssertionFailure(
|
||||
"Could not resolve member signature from XProperty reference",
|
||||
e
|
||||
);
|
||||
}
|
||||
catch (InvocationTargetException e) {
|
||||
throw new AssertionFailure(
|
||||
"Could not resolve member signature from XProperty reference",
|
||||
e.getCause()
|
||||
);
|
||||
else {
|
||||
throw new org.hibernate.HibernateException( "Can only extract Member from a XProperty which is a JavaXMember" );
|
||||
}
|
||||
}
|
||||
|
||||
public static Member getUnderlyingMember(final JavaXMember jxProperty) {
|
||||
return jxProperty.getMember();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,9 +23,9 @@ import org.hibernate.AnnotationException;
|
|||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.annotations.common.reflection.ClassLoadingException;
|
||||
import org.hibernate.annotations.common.reflection.XClass;
|
||||
import org.hibernate.annotations.common.reflection.XProperty;
|
||||
import org.hibernate.boot.spi.BootstrapContext;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.cfg.AccessType;
|
||||
import org.hibernate.cfg.AnnotatedClassType;
|
||||
|
@ -219,19 +219,17 @@ public class MapBinder extends CollectionBinder {
|
|||
//does not make sense for a map key element.setIgnoreNotFound( ignoreNotFound );
|
||||
}
|
||||
else {
|
||||
XClass keyXClass;
|
||||
final XClass keyXClass;
|
||||
AnnotatedClassType classType;
|
||||
if ( BinderHelper.PRIMITIVE_NAMES.contains( mapKeyType ) ) {
|
||||
classType = AnnotatedClassType.NONE;
|
||||
keyXClass = null;
|
||||
}
|
||||
else {
|
||||
try {
|
||||
keyXClass = buildingContext.getBootstrapContext().getReflectionManager().classForName( mapKeyType );
|
||||
}
|
||||
catch (ClassLoadingException e) {
|
||||
throw new AnnotationException( "Unable to find class: " + mapKeyType, e );
|
||||
}
|
||||
final BootstrapContext bootstrapContext = buildingContext.getBootstrapContext();
|
||||
final Class<Object> mapKeyClass = bootstrapContext.getClassLoaderAccess().classForName( mapKeyType );
|
||||
keyXClass = bootstrapContext.getReflectionManager().toXClass( mapKeyClass );
|
||||
|
||||
classType = buildingContext.getMetadataCollector().getClassType( keyXClass );
|
||||
// force in case of attribute override naming the key
|
||||
if ( isEmbedded || mappingDefinedAttributeOverrideOnMapKey( property ) ) {
|
||||
|
|
|
@ -137,9 +137,17 @@ public class StandardRefCursorSupport implements RefCursorSupport {
|
|||
*/
|
||||
public static boolean supportsRefCursors(DatabaseMetaData meta) {
|
||||
try {
|
||||
return meta.supportsRefCursors();
|
||||
final boolean mightSupportIt = meta.supportsRefCursors();
|
||||
// Some databases cheat and don't actually support it correctly: add some additional checks.
|
||||
if ( mightSupportIt ) {
|
||||
if ( "Oracle JDBC driver".equals( meta.getDriverName() ) && meta.getDriverMajorVersion() < 19 ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return mightSupportIt;
|
||||
}
|
||||
catch (SQLException throwable) {
|
||||
catch (Exception throwable) {
|
||||
//If the driver is not compatible with the Java 8 contract, the method might not exit.
|
||||
log.debug( "Unexpected error trying to gauge level of JDBC REF_CURSOR support : " + throwable.getMessage() );
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ public class EventEngine {
|
|||
continue;
|
||||
}
|
||||
|
||||
this.callbackBuilder.buildCallbacksForEntity( persistentClass.getClassName(), callbackRegistry );
|
||||
this.callbackBuilder.buildCallbacksForEntity( persistentClass.getMappedClass(), callbackRegistry );
|
||||
|
||||
for ( Iterator<Property> propertyIterator = persistentClass.getDeclaredPropertyIterator(); propertyIterator.hasNext(); ) {
|
||||
final Property property = propertyIterator.next();
|
||||
|
@ -69,7 +69,7 @@ public class EventEngine {
|
|||
if ( property.getType().isComponentType() ) {
|
||||
this.callbackBuilder.buildCallbacksForEmbeddable(
|
||||
property,
|
||||
persistentClass.getClassName(),
|
||||
persistentClass.getMappedClass(),
|
||||
callbackRegistry
|
||||
);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ import javax.persistence.MappedSuperclass;
|
|||
import javax.persistence.PersistenceException;
|
||||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.annotations.common.reflection.ClassLoadingException;
|
||||
import org.hibernate.annotations.common.reflection.ReflectionManager;
|
||||
import org.hibernate.annotations.common.reflection.XClass;
|
||||
import org.hibernate.annotations.common.reflection.XMethod;
|
||||
|
@ -52,53 +51,38 @@ final class CallbackBuilderLegacyImpl implements CallbackBuilder {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void buildCallbacksForEntity(String entityClassName, CallbackRegistrar callbackRegistrar) {
|
||||
try {
|
||||
final XClass entityXClass = reflectionManager.classForName( entityClassName );
|
||||
final Class entityClass = reflectionManager.toClass( entityXClass );
|
||||
for ( CallbackType callbackType : CallbackType.values() ) {
|
||||
if ( callbackRegistrar.hasRegisteredCallbacks( entityClass, callbackType ) ) {
|
||||
// this most likely means we have a class mapped multiple times using the hbm.xml
|
||||
// "entity name" feature
|
||||
if ( log.isDebugEnabled() ) {
|
||||
log.debugf(
|
||||
"CallbackRegistry reported that Class [%s] already had %s callbacks registered; " +
|
||||
"assuming this means the class was mapped twice " +
|
||||
"(using hbm.xml entity-name support) - skipping subsequent registrations",
|
||||
entityClassName,
|
||||
callbackType.getCallbackAnnotation().getSimpleName()
|
||||
);
|
||||
}
|
||||
continue;
|
||||
public void buildCallbacksForEntity(Class entityClass, CallbackRegistrar callbackRegistrar) {
|
||||
for ( CallbackType callbackType : CallbackType.values() ) {
|
||||
if ( callbackRegistrar.hasRegisteredCallbacks( entityClass, callbackType ) ) {
|
||||
// this most likely means we have a class mapped multiple times using the hbm.xml
|
||||
// "entity name" feature
|
||||
if ( log.isDebugEnabled() ) {
|
||||
log.debugf(
|
||||
"CallbackRegistry reported that Class [%s] already had %s callbacks registered; " +
|
||||
"assuming this means the class was mapped twice " +
|
||||
"(using hbm.xml entity-name support) - skipping subsequent registrations",
|
||||
entityClass.getName(),
|
||||
callbackType.getCallbackAnnotation().getSimpleName()
|
||||
);
|
||||
}
|
||||
final Callback[] callbacks = resolveEntityCallbacks( entityXClass, callbackType, reflectionManager );
|
||||
callbackRegistrar.registerCallbacks( entityClass, callbacks );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
catch (ClassLoadingException e) {
|
||||
throw new MappingException( "entity class not found: " + entityClassName, e );
|
||||
final Callback[] callbacks = resolveEntityCallbacks( entityClass, callbackType, reflectionManager );
|
||||
callbackRegistrar.registerCallbacks( entityClass, callbacks );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildCallbacksForEmbeddable(
|
||||
Property embeddableProperty, String entityClassName, CallbackRegistrar callbackRegistrar) {
|
||||
try {
|
||||
final XClass entityXClass = reflectionManager.classForName( entityClassName );
|
||||
final Class entityClass = reflectionManager.toClass( entityXClass );
|
||||
|
||||
for ( CallbackType callbackType : CallbackType.values() ) {
|
||||
final Callback[] callbacks = resolveEmbeddableCallbacks(
|
||||
entityClass,
|
||||
embeddableProperty,
|
||||
callbackType,
|
||||
reflectionManager
|
||||
);
|
||||
callbackRegistrar.registerCallbacks( entityClass, callbacks );
|
||||
}
|
||||
}
|
||||
catch (ClassLoadingException e) {
|
||||
throw new MappingException( "Class not found: ", e );
|
||||
Property embeddableProperty, Class entityClass, CallbackRegistrar callbackRegistrar) {
|
||||
for ( CallbackType callbackType : CallbackType.values() ) {
|
||||
final Callback[] callbacks = resolveEmbeddableCallbacks(
|
||||
entityClass,
|
||||
embeddableProperty,
|
||||
callbackType,
|
||||
reflectionManager
|
||||
);
|
||||
callbackRegistrar.registerCallbacks( entityClass, callbacks );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,11 +92,11 @@ final class CallbackBuilderLegacyImpl implements CallbackBuilder {
|
|||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "WeakerAccess"})
|
||||
public Callback[] resolveEntityCallbacks(XClass beanClass, CallbackType callbackType, ReflectionManager reflectionManager) {
|
||||
public Callback[] resolveEntityCallbacks(Class entityClass, CallbackType callbackType, ReflectionManager reflectionManager) {
|
||||
List<Callback> callbacks = new ArrayList<>();
|
||||
List<String> callbacksMethodNames = new ArrayList<>();
|
||||
List<Class> orderedListeners = new ArrayList<>();
|
||||
XClass currentClazz = beanClass;
|
||||
XClass currentClazz = reflectionManager.toXClass( entityClass );
|
||||
boolean stopListeners = false;
|
||||
boolean stopDefaultListeners = false;
|
||||
do {
|
||||
|
@ -140,7 +124,7 @@ final class CallbackBuilderLegacyImpl implements CallbackBuilder {
|
|||
"Adding %s as %s callback for entity %s",
|
||||
methodName,
|
||||
callbackType.getCallbackAnnotation().getSimpleName(),
|
||||
beanClass.getName()
|
||||
entityClass.getName()
|
||||
);
|
||||
}
|
||||
callbacks.add( 0, callback ); //superclass first
|
||||
|
@ -149,7 +133,7 @@ final class CallbackBuilderLegacyImpl implements CallbackBuilder {
|
|||
else {
|
||||
throw new PersistenceException(
|
||||
"You can only annotate one callback method with "
|
||||
+ callbackType.getCallbackAnnotation().getName() + " in bean class: " + beanClass.getName()
|
||||
+ callbackType.getCallbackAnnotation().getName() + " in bean class: " + entityClass.getName()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -216,7 +200,7 @@ final class CallbackBuilderLegacyImpl implements CallbackBuilder {
|
|||
"Adding %s as %s callback for entity %s",
|
||||
methodName,
|
||||
callbackType.getCallbackAnnotation().getSimpleName(),
|
||||
beanClass.getName()
|
||||
entityClass.getName()
|
||||
);
|
||||
}
|
||||
callbacks.add( 0, callback ); // listeners first
|
||||
|
@ -225,7 +209,7 @@ final class CallbackBuilderLegacyImpl implements CallbackBuilder {
|
|||
throw new PersistenceException(
|
||||
"You can only annotate one callback method with "
|
||||
+ callbackType.getCallbackAnnotation().getName()
|
||||
+ " in bean class: " + beanClass.getName()
|
||||
+ " in bean class: " + entityClass.getName()
|
||||
+ " and callback listener: " + listener.getName()
|
||||
);
|
||||
}
|
||||
|
@ -240,8 +224,8 @@ final class CallbackBuilderLegacyImpl implements CallbackBuilder {
|
|||
@SuppressWarnings({"unchecked", "WeakerAccess"})
|
||||
public Callback[] resolveEmbeddableCallbacks(Class entityClass, Property embeddableProperty, CallbackType callbackType, ReflectionManager reflectionManager) {
|
||||
|
||||
final String embeddableClassName = embeddableProperty.getType().getReturnedClass().getName();
|
||||
final XClass embeddableXClass = reflectionManager.classForName( embeddableClassName );
|
||||
final Class embeddableClass = embeddableProperty.getType().getReturnedClass();
|
||||
final XClass embeddableXClass = reflectionManager.toXClass( embeddableClass );
|
||||
final Getter embeddableGetter = embeddableProperty.getGetter( entityClass );
|
||||
final List<Callback> callbacks = new ArrayList<>();
|
||||
final List<String> callbacksMethodNames = new ArrayList<>();
|
||||
|
|
|
@ -12,12 +12,12 @@ import org.hibernate.mapping.Property;
|
|||
final class EmptyCallbackBuilder implements CallbackBuilder {
|
||||
|
||||
@Override
|
||||
public void buildCallbacksForEntity(String entityClassName, CallbackRegistrar callbackRegistrar) {
|
||||
public void buildCallbacksForEntity(Class entityClass, CallbackRegistrar callbackRegistrar) {
|
||||
//no-op
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildCallbacksForEmbeddable(Property embeddableProperty, String entityClassName, CallbackRegistrar callbackRegistrar) {
|
||||
public void buildCallbacksForEmbeddable(Property embeddableProperty, Class entityClass, CallbackRegistrar callbackRegistrar) {
|
||||
//no-op
|
||||
}
|
||||
|
||||
|
|
|
@ -28,11 +28,11 @@ public interface CallbackBuilder {
|
|||
void registerCallbacks(Class entityClass, Callback[] callbacks);
|
||||
}
|
||||
|
||||
void buildCallbacksForEntity(String entityClassName, CallbackRegistrar callbackRegistrar);
|
||||
void buildCallbacksForEntity(Class entityClass, CallbackRegistrar callbackRegistrar);
|
||||
|
||||
void buildCallbacksForEmbeddable(
|
||||
Property embeddableProperty,
|
||||
String entityClassName,
|
||||
Class entityClass,
|
||||
CallbackRegistrar callbackRegistrar);
|
||||
|
||||
void release();
|
||||
|
|
|
@ -11,7 +11,6 @@ import java.util.Set;
|
|||
import javax.persistence.Column;
|
||||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.annotations.common.reflection.ClassLoadingException;
|
||||
import org.hibernate.annotations.common.reflection.ReflectionManager;
|
||||
import org.hibernate.annotations.common.reflection.XClass;
|
||||
import org.hibernate.annotations.common.reflection.XProperty;
|
||||
|
@ -310,14 +309,7 @@ public class RevisionInfoConfiguration {
|
|||
for ( PersistentClass persistentClass : metadata.getEntityBindings() ) {
|
||||
// Ensure we're in POJO, not dynamic model, mapping.
|
||||
if (persistentClass.getClassName() != null) {
|
||||
XClass clazz;
|
||||
try {
|
||||
clazz = reflectionManager.classForName( persistentClass.getClassName() );
|
||||
}
|
||||
catch (ClassLoadingException e) {
|
||||
throw new MappingException( e );
|
||||
}
|
||||
|
||||
XClass clazz = reflectionManager.toXClass( persistentClass.getMappedClass() );
|
||||
final RevisionEntity revisionEntity = clazz.getAnnotation( RevisionEntity.class );
|
||||
if ( revisionEntity != null ) {
|
||||
if (revisionEntityFound) {
|
||||
|
|
|
@ -22,6 +22,7 @@ import javax.persistence.JoinColumn;
|
|||
import org.dom4j.Element;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.annotations.common.reflection.ReflectionManager;
|
||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||
import org.hibernate.envers.ModificationStore;
|
||||
import org.hibernate.envers.RelationTargetAuditMode;
|
||||
import org.hibernate.envers.configuration.internal.metadata.reader.AuditedPropertiesReader;
|
||||
|
@ -658,9 +659,12 @@ public final class CollectionMetadataGenerator {
|
|||
.getMetadataBuildingOptions()
|
||||
.getReflectionManager();
|
||||
|
||||
final ClassLoaderService classLoaderService = mainGenerator.getGlobalCfg()
|
||||
.getEnversService()
|
||||
.getClassLoaderService();
|
||||
new ComponentAuditedPropertiesReader(
|
||||
ModificationStore.FULL,
|
||||
new AuditedPropertiesReader.ComponentPropertiesSource( reflectionManager, component ),
|
||||
new AuditedPropertiesReader.ComponentPropertiesSource( classLoaderService, reflectionManager, component ),
|
||||
auditData, mainGenerator.getGlobalCfg(), reflectionManager, ""
|
||||
).read();
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
package org.hibernate.envers.configuration.internal.metadata.reader;
|
||||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.annotations.common.reflection.ClassLoadingException;
|
||||
import org.hibernate.annotations.common.reflection.ReflectionManager;
|
||||
import org.hibernate.annotations.common.reflection.XClass;
|
||||
import org.hibernate.envers.AuditTable;
|
||||
|
@ -96,30 +95,25 @@ public final class AnnotationsMetadataReader {
|
|||
return auditData;
|
||||
}
|
||||
|
||||
try {
|
||||
final XClass xclass = reflectionManager.classForName( pc.getClassName() );
|
||||
final XClass xclass = reflectionManager.toXClass( pc.getMappedClass() );
|
||||
|
||||
final ModificationStore defaultStore = getDefaultAudited( xclass );
|
||||
if ( defaultStore != null ) {
|
||||
auditData.setDefaultAudited( true );
|
||||
}
|
||||
|
||||
new AuditedPropertiesReader(
|
||||
defaultStore,
|
||||
new PersistentClassPropertiesSource( xclass ),
|
||||
auditData,
|
||||
globalCfg,
|
||||
reflectionManager,
|
||||
""
|
||||
).read();
|
||||
|
||||
addAuditTable( xclass );
|
||||
addAuditSecondaryTables( xclass );
|
||||
}
|
||||
catch (ClassLoadingException e) {
|
||||
throw new MappingException( e );
|
||||
final ModificationStore defaultStore = getDefaultAudited( xclass );
|
||||
if ( defaultStore != null ) {
|
||||
auditData.setDefaultAudited( true );
|
||||
}
|
||||
|
||||
new AuditedPropertiesReader(
|
||||
defaultStore,
|
||||
new PersistentClassPropertiesSource( xclass ),
|
||||
auditData,
|
||||
globalCfg,
|
||||
reflectionManager,
|
||||
""
|
||||
).read();
|
||||
|
||||
addAuditTable( xclass );
|
||||
addAuditSecondaryTables( xclass );
|
||||
|
||||
return auditData;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,10 +25,11 @@ import javax.persistence.Version;
|
|||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.annotations.common.reflection.ClassLoadingException;
|
||||
import org.hibernate.annotations.common.reflection.ReflectionManager;
|
||||
import org.hibernate.annotations.common.reflection.XClass;
|
||||
import org.hibernate.annotations.common.reflection.XProperty;
|
||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||
import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
|
||||
import org.hibernate.envers.AuditJoinTable;
|
||||
import org.hibernate.envers.AuditMappedBy;
|
||||
import org.hibernate.envers.AuditOverride;
|
||||
|
@ -432,8 +433,10 @@ public class AuditedPropertiesReader {
|
|||
// Marking component properties as placed directly in class (not inside another component).
|
||||
componentData.setBeanName( null );
|
||||
|
||||
final ClassLoaderService classLoaderService = globalCfg.getEnversService().getClassLoaderService();
|
||||
|
||||
final PersistentPropertiesSource componentPropertiesSource = new ComponentPropertiesSource(
|
||||
reflectionManager,
|
||||
classLoaderService, reflectionManager,
|
||||
propertyValue
|
||||
);
|
||||
final AuditedPropertiesReader audPropReader = new AuditedPropertiesReader(
|
||||
|
@ -459,7 +462,10 @@ public class AuditedPropertiesReader {
|
|||
componentPropertiesSource = new DynamicComponentSource( reflectionManager, propertyValue, property );
|
||||
}
|
||||
else {
|
||||
componentPropertiesSource = new ComponentPropertiesSource( reflectionManager, propertyValue );
|
||||
final ClassLoaderService classLoaderService = this.globalCfg.getEnversService().getClassLoaderService();
|
||||
componentPropertiesSource = new ComponentPropertiesSource(
|
||||
classLoaderService,
|
||||
reflectionManager, propertyValue );
|
||||
}
|
||||
|
||||
final ComponentAuditedPropertiesReader audPropReader = new ComponentAuditedPropertiesReader(
|
||||
|
@ -786,14 +792,17 @@ public class AuditedPropertiesReader {
|
|||
this.component = component;
|
||||
}
|
||||
|
||||
public ComponentPropertiesSource(ReflectionManager reflectionManager, Component component) {
|
||||
public ComponentPropertiesSource(
|
||||
ClassLoaderService classLoaderService,
|
||||
ReflectionManager reflectionManager,
|
||||
Component component) {
|
||||
try {
|
||||
this.xclass = reflectionManager.classForName( component.getComponentClassName() );
|
||||
Class<Object> objectClass = classLoaderService.classForName( component.getComponentClassName() );
|
||||
this.xclass = reflectionManager.toXClass( objectClass );
|
||||
}
|
||||
catch ( ClassLoadingException e ) {
|
||||
throw new MappingException( e );
|
||||
}
|
||||
|
||||
this.component = component;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
|
||||
hibernate.dialect org.hibernate.spatial.dialect.oracle.OracleSpatial10gDialect
|
||||
hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
|
||||
hibernate.connection.driver_class oracle.jdbc.OracleDriver
|
||||
hibernate.connection.url jdbc:oracle:thin:@localhost:1521:ORCLCDB
|
||||
hibernate.connection.username C##hibernate
|
||||
hibernate.connection.password hibernate
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
|
||||
hibernate.dialect org.hibernate.spatial.dialect.oracle.OracleSpatial10gDialect
|
||||
hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
|
||||
hibernate.connection.driver_class oracle.jdbc.OracleDriver
|
||||
hibernate.connection.url jdbc:oracle:thin:@localhost:1521:ORCLCDB
|
||||
hibernate.connection.username C##hibernate
|
||||
hibernate.connection.password hibernate
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
|
||||
hibernate.dialect org.hibernate.spatial.dialect.oracle.OracleSpatialSDO10gDialect
|
||||
hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
|
||||
hibernate.connection.driver_class oracle.jdbc.OracleDriver
|
||||
hibernate.connection.url jdbc:oracle:thin:@localhost:1521:ORCLCDB
|
||||
hibernate.connection.username C##hibernate
|
||||
hibernate.connection.password hibernate
|
||||
|
|
|
@ -49,13 +49,13 @@ hibernate.connection.password @jdbc.pass@
|
|||
##
|
||||
#hibernate.spatial.connection_finder org.hibernate.spatial.dialect.oracle.TestConnectionFinder
|
||||
#hibernate.dialect org.hibernate.spatial.dialect.oracle.OracleSpatial10gDialect
|
||||
#hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
|
||||
#hibernate.connection.driver_class oracle.jdbc.OracleDriver
|
||||
#hibernate.connection.url jdbc:oracle:thin:@localhost:1521/orcl12c
|
||||
#hibernate.connection.username C##hibernate
|
||||
#hibernate.connection.password hibernate
|
||||
|
||||
#hibernate.dialect org.hibernate.spatial.dialect.oracle.OracleSpatialSDO10gDialect
|
||||
#hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
|
||||
#hibernate.connection.driver_class oracle.jdbc.OracleDriver
|
||||
#hibernate.connection.url jdbc:oracle:thin:@localhost:1521/orcl12c
|
||||
#hibernate.connection.username C##hibernate
|
||||
#hibernate.connection.password hibernate
|
||||
|
|
Loading…
Reference in New Issue