HHH-9680 updated OSGi quickstarts, added necessary contracts to Envers blueprint, corrected a few uses of ReflectionManager

This commit is contained in:
Brett Meyer 2015-03-30 15:36:31 -04:00
parent 212f61a24c
commit 410a785dfe
22 changed files with 602 additions and 594 deletions

View File

@ -2,8 +2,6 @@
<features>
<feature name="hibernate-test">
<feature>karaf-framework</feature>
<!-- JTA -->
<config name="org.apache.aries.transaction">
aries.transaction.recoverable = true
@ -51,16 +49,18 @@
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/1.6.1_5</bundle>
<!-- These do not natively support OSGi, so wrap with BND. -->
<bundle>wrap:mvn:org.jboss/jandex/1.1.0.Alpha1</bundle>
<bundle>wrap:mvn:org.jboss/jandex/1.1.0.Final</bundle>
<bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
<bundle>mvn:org.jboss.logging/jboss-logging/3.1.0.GA</bundle>
<bundle>mvn:org.apache.logging.log4j/log4j-api/2.0</bundle>
<bundle>mvn:log4j/log4j/1.2.17</bundle>
<bundle>mvn:org.jboss.logging/jboss-logging/3.2.1.Final</bundle>
<bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>
<bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.3.Final</bundle>
<bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.5.Final</bundle>
<bundle>mvn:org.hibernate/hibernate-core/4.3.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate/hibernate-entitymanager/4.3.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate/hibernate-core/5.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate/hibernate-entitymanager/5.0.0-SNAPSHOT</bundle>
<!-- TODO: It seems that the persistence unit bundle needs to be started
before hibernate-osgi. When the BundleActivator is started,
@ -70,6 +70,6 @@
watch for bundles with PUs before registering the persistence provider? -->
<bundle>mvn:org.hibernate.osgi/managed-jpa/1.0.0</bundle>
<bundle>mvn:org.hibernate/hibernate-osgi/4.3.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate/hibernate-osgi/5.0.0-SNAPSHOT</bundle>
</feature>
</features>

View File

@ -39,17 +39,17 @@
<!-- This bundle makes use of Karaf commands to demonstrate core persistence operations. Feel free to remove it. -->
<command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
<command name="dp/add">
<command>
<action class="org.hibernate.osgitest.command.AddCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command name="dp/getAll">
<command>
<action class="org.hibernate.osgitest.command.GetAllCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command name="dp/deleteAll">
<command>
<action class="org.hibernate.osgitest.command.DeleteAllCommand">
<property name="dpService" ref="dpService"/>
</action>

View File

@ -2,8 +2,6 @@
<features>
<feature name="hibernate-test">
<feature>karaf-framework</feature>
<!-- JTA -->
<bundle start-level="30">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
@ -24,17 +22,19 @@
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/1.6.1_5</bundle>
<!-- These do not natively support OSGi, so wrap with BND. -->
<bundle>wrap:mvn:org.jboss/jandex/1.1.0.Alpha1</bundle>
<bundle>wrap:mvn:org.jboss/jandex/1.1.0.Final</bundle>
<bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
<bundle>mvn:org.jboss.logging/jboss-logging/3.1.0.GA</bundle>
<bundle>mvn:org.apache.logging.log4j/log4j-api/2.0</bundle>
<bundle>mvn:log4j/log4j/1.2.17</bundle>
<bundle>mvn:org.jboss.logging/jboss-logging/3.2.1.Final</bundle>
<bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>
<bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.3.Final</bundle>
<bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.5.Final</bundle>
<bundle>mvn:org.hibernate/hibernate-core/4.3.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate/hibernate-entitymanager/4.3.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate/hibernate-osgi/4.3.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate/hibernate-core/5.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate/hibernate-entitymanager/5.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate/hibernate-osgi/5.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate.osgi/unmanaged-jpa/1.0.0</bundle>
</feature>

View File

@ -30,7 +30,7 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.3.0-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>

View File

@ -20,10 +20,9 @@
*/
package org.hibernate.osgitest;
import org.hibernate.cfg.Configuration;
import org.hibernate.boot.Metadata;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.integrator.spi.Integrator;
import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.service.spi.SessionFactoryServiceRegistry;
@ -32,11 +31,10 @@ import org.hibernate.service.spi.SessionFactoryServiceRegistry;
*/
public class TestIntegrator implements Integrator {
public void integrate(Configuration configuration, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
System.out.println("Integrator#integrate");
}
public void integrate(MetadataImplementor metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
public void integrate(
Metadata metadata,
SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
System.out.println("Integrator#integrate");
}

View File

@ -20,8 +20,8 @@
*/
package org.hibernate.osgitest;
import org.hibernate.metamodel.spi.TypeContributions;
import org.hibernate.metamodel.spi.TypeContributor;
import org.hibernate.boot.model.TypeContributions;
import org.hibernate.boot.model.TypeContributor;
import org.hibernate.service.ServiceRegistry;

View File

@ -30,29 +30,30 @@
<service ref="integrator" interface="org.hibernate.integrator.spi.Integrator"/>
<bean id="strategyRegistrationProvider" class="org.hibernate.osgitest.TestStrategyRegistrationProvider"/>
<service ref="strategyRegistrationProvider" interface="org.hibernate.boot.registry.selector.StrategyRegistrationProvider"/>
<service ref="strategyRegistrationProvider"
interface="org.hibernate.boot.registry.selector.StrategyRegistrationProvider"/>
<bean id="typeContributor" class="org.hibernate.osgitest.TestTypeContributor"/>
<service ref="typeContributor" interface="org.hibernate.boot.model.TypeContributor"/>
<!-- This bundle makes use of Karaf commands to demonstrate core persistence operations. Feel free to remove it. -->
<command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
<command name="dp:add">
<command>
<action class="org.hibernate.osgitest.command.AddCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command name="dp:update">
<command>
<action class="org.hibernate.osgitest.command.UpdateCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command name="dp:getAll">
<command>
<action class="org.hibernate.osgitest.command.GetAllCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command name="dp:deleteAll">
<command>
<action class="org.hibernate.osgitest.command.DeleteAllCommand">
<property name="dpService" ref="dpService"/>
</action>

View File

@ -2,7 +2,7 @@
<features>
<feature name="hibernate-test">
<feature>karaf-framework</feature>
<!--<feature>karaf-framework</feature>-->
<!-- JTA -->
<bundle start-level="30">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
@ -24,7 +24,7 @@
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/1.6.1_5</bundle>
<!-- These do not natively support OSGi, so wrap with BND. -->
<bundle>wrap:mvn:org.jboss/jandex/1.1.0.Alpha1</bundle>
<bundle>wrap:mvn:org.jboss/jandex/1.1.0.Final</bundle>
<!-- Optional. Needed to test C3P0 connection pools. -->
<!-- <bundle>wrap:mvn:c3p0/c3p0/0.9.1</bundle> -->
<!-- Optional. Needed to test Proxool connection pools. -->
@ -33,10 +33,12 @@
<!-- <bundle>wrap:mvn:net.sf.ehcache/ehcache-core/2.4.3</bundle> -->
<bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
<bundle>mvn:org.jboss.logging/jboss-logging/3.1.0.GA</bundle>
<bundle>mvn:org.apache.logging.log4j/log4j-api/2.0</bundle>
<bundle>mvn:log4j/log4j/1.2.17</bundle>
<bundle>mvn:org.jboss.logging/jboss-logging/3.2.1.Final</bundle>
<bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>
<bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.3.Final</bundle>
<bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.5.Final</bundle>
<!-- JACC is optional. -->
<!--<bundle>mvn:javax.servlet/javax.servlet-api/3.0.1</bundle>
@ -56,15 +58,15 @@
<bundle>mvn:org.jgroups/jgroups/3.2.8.Final</bundle>
<bundle>mvn:org.infinispan/infinispan-core/5.2.0.Beta3</bundle> -->
<bundle>mvn:org.hibernate/hibernate-core/4.3.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate/hibernate-core/5.0.0-SNAPSHOT</bundle>
<!-- TODO: Shouldn't need this, but hibernate-osgi's activator is a catch-all for SF and EMF. -->
<bundle>mvn:org.hibernate/hibernate-entitymanager/4.3.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate/hibernate-envers/4.3.0-SNAPSHOT</bundle>
<!-- <bundle>mvn:org.hibernate/hibernate-c3p0/4.3.0-SNAPSHOT</bundle> -->
<!-- <bundle>mvn:org.hibernate/hibernate-proxool/4.3.0-SNAPSHOT</bundle> -->
<!-- <bundle>mvn:org.hibernate/hibernate-ehcache/4.3.0-SNAPSHOT</bundle> -->
<!-- <bundle>mvn:org.hibernate/hibernate-infinispan/4.3.0-SNAPSHOT</bundle> -->
<bundle>mvn:org.hibernate/hibernate-osgi/4.3.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate/hibernate-entitymanager/5.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate/hibernate-envers/5.0.0-SNAPSHOT</bundle>
<!-- <bundle>mvn:org.hibernate/hibernate-c3p0/5.0.0-SNAPSHOT</bundle> -->
<!-- <bundle>mvn:org.hibernate/hibernate-proxool/5.0.0-SNAPSHOT</bundle> -->
<!-- <bundle>mvn:org.hibernate/hibernate-ehcache/5.0.0-SNAPSHOT</bundle> -->
<!-- <bundle>mvn:org.hibernate/hibernate-infinispan/5.0.0-SNAPSHOT</bundle> -->
<bundle>mvn:org.hibernate/hibernate-osgi/5.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate.osgi/unmanaged-native/1.0.0</bundle>
</feature>

View File

@ -30,12 +30,12 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.0-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-envers</artifactId>
<version>4.3.0-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>

View File

@ -20,11 +20,6 @@
*/
package org.hibernate.osgitest;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import org.hibernate.Hibernate;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.hibernate.envers.AuditReader;
@ -32,6 +27,10 @@ import org.hibernate.envers.AuditReaderFactory;
import org.hibernate.envers.DefaultRevisionEntity;
import org.hibernate.osgitest.entity.DataPoint;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
/**
* @author Brett Meyer
*/

View File

@ -20,10 +20,9 @@
*/
package org.hibernate.osgitest;
import org.hibernate.cfg.Configuration;
import org.hibernate.boot.Metadata;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.integrator.spi.Integrator;
import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.service.spi.SessionFactoryServiceRegistry;
@ -32,11 +31,10 @@ import org.hibernate.service.spi.SessionFactoryServiceRegistry;
*/
public class TestIntegrator implements Integrator {
public void integrate(Configuration configuration, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
System.out.println("Integrator#integrate");
}
public void integrate(MetadataImplementor metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
public void integrate(
Metadata metadata,
SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
System.out.println("Integrator#integrate");
}

View File

@ -20,8 +20,8 @@
*/
package org.hibernate.osgitest;
import org.hibernate.metamodel.spi.TypeContributions;
import org.hibernate.metamodel.spi.TypeContributor;
import org.hibernate.boot.model.TypeContributions;
import org.hibernate.boot.model.TypeContributor;
import org.hibernate.service.ServiceRegistry;

View File

@ -30,44 +30,45 @@
<service ref="integrator" interface="org.hibernate.integrator.spi.Integrator"/>
<bean id="strategyRegistrationProvider" class="org.hibernate.osgitest.TestStrategyRegistrationProvider"/>
<service ref="strategyRegistrationProvider" interface="org.hibernate.boot.registry.selector.StrategyRegistrationProvider"/>
<service ref="strategyRegistrationProvider"
interface="org.hibernate.boot.registry.selector.StrategyRegistrationProvider"/>
<bean id="typeContributor" class="org.hibernate.osgitest.TestTypeContributor"/>
<service ref="typeContributor" interface="org.hibernate.boot.model.TypeContributor"/>
<!-- This bundle makes use of Karaf commands to demonstrate core persistence operations. Feel free to remove it. -->
<command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
<command name="dp:add">
<command>
<action class="org.hibernate.osgitest.command.AddCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command name="dp:update">
<command>
<action class="org.hibernate.osgitest.command.UpdateCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command name="dp:get">
<command>
<action class="org.hibernate.osgitest.command.GetCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command name="dp:load">
<command>
<action class="org.hibernate.osgitest.command.LoadCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command name="dp:getAll">
<command>
<action class="org.hibernate.osgitest.command.GetAllCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command name="dp:getRevisions">
<command>
<action class="org.hibernate.osgitest.command.GetRevisionsCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command name="dp:deleteAll">
<command>
<action class="org.hibernate.osgitest.command.DeleteAllCommand">
<property name="dpService" ref="dpService"/>
</action>

View File

@ -23,16 +23,9 @@
*/
package org.hibernate.boot.model.source.internal.annotations;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
import javax.persistence.Entity;
import org.dom4j.Document;
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;
@ -50,11 +43,17 @@ import org.hibernate.cfg.annotations.reflection.AttributeConverterDefinitionColl
import org.hibernate.cfg.annotations.reflection.JPAMetadataProvider;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.internal.util.collections.CollectionHelper;
import org.jboss.jandex.IndexView;
import org.jboss.logging.Logger;
import org.dom4j.Document;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
import javax.persistence.Entity;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author Steve Ebersole
@ -143,9 +142,9 @@ public class AnnotationMetadataSourceProcessorImpl implements MetadataSourceProc
@SuppressWarnings("deprecation")
private XClass toXClass(String className, ReflectionManager reflectionManager) {
try {
return reflectionManager.classForName( className, this.getClass() );
return reflectionManager.classForName( className );
}
catch ( ClassNotFoundException e ) {
catch ( ClassLoadingException e ) {
throw new AnnotationException( "Unable to load class defined in XML: " + className, e );
}
}

View File

@ -23,17 +23,6 @@
*/
package org.hibernate.cfg;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
import org.hibernate.AnnotationException;
import org.hibernate.AssertionFailure;
import org.hibernate.MappingException;
@ -41,6 +30,7 @@ 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;
@ -66,9 +56,19 @@ import org.hibernate.mapping.SyntheticProperty;
import org.hibernate.mapping.Table;
import org.hibernate.mapping.ToOne;
import org.hibernate.mapping.Value;
import org.jboss.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
/**
* @author Emmanuel Bernard
*/
@ -859,9 +859,9 @@ public class BinderHelper {
final XClass persistentXClass;
try {
persistentXClass = buildingContext.getBuildingOptions().getReflectionManager()
.classForName( propertyHolder.getPersistentClass().getClassName(), AnnotationBinder.class );
.classForName( propertyHolder.getPersistentClass().getClassName() );
}
catch ( ClassNotFoundException e ) {
catch ( ClassLoadingException e ) {
throw new AssertionFailure( "PersistentClass name cannot be converted into a Class", e);
}
if ( propertyHolder.isInIdClass() ) {

View File

@ -23,19 +23,12 @@
*/
package org.hibernate.cfg.annotations;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.MapKeyClass;
import org.hibernate.AnnotationException;
import org.hibernate.AssertionFailure;
import org.hibernate.FetchMode;
import org.hibernate.MappingException;
import org.hibernate.annotations.MapKeyType;
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.MetadataBuildingContext;
@ -68,6 +61,14 @@ import org.hibernate.mapping.ToOne;
import org.hibernate.mapping.Value;
import org.hibernate.sql.Template;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.MapKeyClass;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;
/**
* Implementation to bind a Map
*
@ -185,9 +186,9 @@ public class MapBinder extends CollectionBinder {
}
else {
try {
keyXClass = buildingContext.getBuildingOptions().getReflectionManager().classForName( mapKeyType, MapBinder.class );
keyXClass = buildingContext.getBuildingOptions().getReflectionManager().classForName( mapKeyType );
}
catch (ClassNotFoundException e) {
catch (ClassLoadingException e) {
throw new AnnotationException( "Unable to find class: " + mapKeyType, e );
}
classType = buildingContext.getMetadataCollector().getClassType( keyXClass );

View File

@ -23,27 +23,27 @@
*/
package org.hibernate.jpa.event.internal.jpa;
import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
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;
import org.hibernate.jpa.event.spi.jpa.Callback;
import org.hibernate.jpa.event.spi.jpa.ListenerFactory;
import org.jboss.logging.Logger;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.ExcludeDefaultListeners;
import javax.persistence.ExcludeSuperclassListeners;
import javax.persistence.MappedSuperclass;
import javax.persistence.PersistenceException;
import org.hibernate.MappingException;
import org.hibernate.annotations.common.reflection.ReflectionManager;
import org.hibernate.annotations.common.reflection.XClass;
import org.hibernate.annotations.common.reflection.XMethod;
import org.hibernate.jpa.event.spi.jpa.Callback;
import org.hibernate.jpa.event.spi.jpa.ListenerFactory;
import org.jboss.logging.Logger;
import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
/**
* @author <a href="mailto:kabir.khan@jboss.org">Kabir Khan</a>
@ -64,14 +64,14 @@ public class LegacyCallbackProcessor implements CallbackProcessor {
public void processCallbacksForEntity(Object entityObject, CallbackRegistryImpl callbackRegistry) {
final String entityClassName = (String) entityObject;
try {
final XClass entityXClass = reflectionManager.classForName( entityClassName, this.getClass() );
final XClass entityXClass = reflectionManager.classForName( entityClassName );
final Class entityClass = reflectionManager.toClass( entityXClass );
for ( Class annotationClass : CALLBACK_ANNOTATION_CLASSES ) {
final Callback[] callbacks = resolveCallbacks( entityXClass, annotationClass, reflectionManager );
callbackRegistry.addEntityCallbacks( entityClass, annotationClass, callbacks );
}
}
catch (ClassNotFoundException e) {
catch (ClassLoadingException e) {
throw new MappingException( "entity class not found: " + entityClassName, e );
}
}

View File

@ -26,6 +26,7 @@ package org.hibernate.envers.configuration.internal;
import org.dom4j.Document;
import org.dom4j.Element;
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;
@ -319,9 +320,9 @@ public class RevisionInfoConfiguration {
if (persistentClass.getClassName() != null) {
XClass clazz;
try {
clazz = reflectionManager.classForName( persistentClass.getClassName(), this.getClass() );
clazz = reflectionManager.classForName( persistentClass.getClassName() );
}
catch (ClassNotFoundException e) {
catch (ClassLoadingException e) {
throw new MappingException( e );
}

View File

@ -23,10 +23,8 @@
*/
package org.hibernate.envers.configuration.internal.metadata.reader;
import java.lang.annotation.Annotation;
import java.util.Iterator;
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;
@ -38,6 +36,9 @@ import org.hibernate.envers.configuration.internal.GlobalConfiguration;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import java.lang.annotation.Annotation;
import java.util.Iterator;
/**
* A helper class to read versioning meta-data from annotations on a persistent class.
*
@ -113,7 +114,7 @@ public final class AnnotationsMetadataReader {
}
try {
final XClass xclass = reflectionManager.classForName( pc.getClassName(), this.getClass() );
final XClass xclass = reflectionManager.classForName( pc.getClassName() );
final ModificationStore defaultStore = getDefaultAudited( xclass );
if ( defaultStore != null ) {
@ -132,7 +133,7 @@ public final class AnnotationsMetadataReader {
addAuditTable( xclass );
addAuditSecondaryTables( xclass );
}
catch (ClassNotFoundException e) {
catch (ClassLoadingException e) {
throw new MappingException( e );
}

View File

@ -23,19 +23,8 @@
*/
package org.hibernate.envers.configuration.internal.metadata.reader;
import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.persistence.JoinColumn;
import javax.persistence.MapKey;
import javax.persistence.OneToMany;
import javax.persistence.Version;
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;
@ -57,6 +46,18 @@ import org.hibernate.mapping.Component;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.Value;
import javax.persistence.JoinColumn;
import javax.persistence.MapKey;
import javax.persistence.OneToMany;
import javax.persistence.Version;
import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import static org.hibernate.envers.internal.tools.Tools.newHashMap;
import static org.hibernate.envers.internal.tools.Tools.newHashSet;
@ -732,9 +733,9 @@ public class AuditedPropertiesReader {
public ComponentPropertiesSource(ReflectionManager reflectionManager, Component component) {
try {
this.xclass = reflectionManager.classForName( component.getComponentClassName(), this.getClass() );
this.xclass = reflectionManager.classForName( component.getComponentClassName() );
}
catch ( ClassNotFoundException e ) {
catch ( ClassLoadingException e ) {
throw new MappingException( e );
}

View File

@ -10,4 +10,10 @@
<bean id="typeContributor" class="org.hibernate.envers.boot.internal.TypeContributorImpl"/>
<service ref="typeContributor" interface="org.hibernate.boot.model.TypeContributor"/>
<bean id="serviceContributor" class="org.hibernate.envers.boot.internal.EnversServiceContributor"/>
<service ref="serviceContributor" interface="org.hibernate.service.spi.ServiceContributor"/>
<bean id="additionalJaxbMappingProducer" class="org.hibernate.envers.boot.internal.AdditionalJaxbMappingProducerImpl"/>
<service ref="additionalJaxbMappingProducer" interface="org.hibernate.boot.spi.AdditionalJaxbMappingProducer"/>
</blueprint>