HHH-7490 - Integrate Envers with Metamodel

This commit is contained in:
Gail Badner 2014-03-21 13:15:11 -07:00
parent 24ff8d6eae
commit 62704e4daa
10 changed files with 16 additions and 24 deletions

View File

@ -25,10 +25,7 @@ package org.hibernate.envers.configuration.internal;
import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javassist.util.proxy.MethodHandler;
@ -38,7 +35,7 @@ import org.jboss.jandex.AnnotationInstance;
import org.hibernate.HibernateException;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.metamodel.internal.source.annotations.util.JandexHelper;
import org.hibernate.metamodel.source.internal.annotations.util.JandexHelper;
/**
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)

View File

@ -47,8 +47,8 @@ import org.hibernate.envers.internal.revisioninfo.RevisionInfoQueryCreator;
import org.hibernate.envers.internal.tools.MutableBoolean;
import org.hibernate.envers.internal.tools.Tools;
import org.hibernate.internal.util.xml.XMLHelper;
import org.hibernate.metamodel.internal.source.annotations.util.JandexHelper;
import org.hibernate.metamodel.internal.source.annotations.util.JPADotNames;
import org.hibernate.metamodel.source.internal.annotations.util.JPADotNames;
import org.hibernate.metamodel.source.internal.annotations.util.JandexHelper;
import org.hibernate.metamodel.spi.InFlightMetadataCollector;
import org.hibernate.metamodel.spi.binding.EntityBinding;
import org.hibernate.metamodel.spi.binding.AttributeBinding;
@ -291,7 +291,7 @@ public class RevisionInfoConfiguration {
revisionTimestampProperty
);
HibernateTypeDescriptor revisionTimestampType = revisionTimestampAttribute.getHibernateTypeDescriptor();
final String revisionTimestampClassName = revisionTimestampType.getJavaTypeDescriptor().getName().fullName();
final String revisionTimestampClassName = revisionTimestampType.getJavaTypeDescriptor().getName().toString();
if ( Long.TYPE.getName().equals( revisionTimestampClassName ) ||
java.util.Date.class.getName().equals( revisionTimestampClassName ) ||
Date.class.getName().equals( revisionTimestampClassName) ) {
@ -339,7 +339,7 @@ public class RevisionInfoConfiguration {
collectionBinding
.getPluralAttributeElementBinding()
.getHibernateTypeDescriptor()
.getJavaTypeDescriptor().getName().fullName();
.getJavaTypeDescriptor().getName().toString();
if ( String.class.getName().equals( elementType ) ) {
modifiedEntityNamesData = new PropertyData(
modifiedEntityNamesProperty,

View File

@ -632,7 +632,7 @@ public final class AuditMetadataGenerator {
final String parentEntityName = null;
final EntityConfiguration entityCfg = new EntityConfiguration(
entityName,
entityBinding.getEntity().getDescriptor().getName().fullName(),
entityBinding.getEntity().getDescriptor().getName().toString(),
idMapper,
propertyMapper,
parentEntityName
@ -722,7 +722,7 @@ public final class AuditMetadataGenerator {
// Storing the generated configuration
final EntityConfiguration entityCfg = new EntityConfiguration(
auditEntityName,
entityBinding.getEntity().getDescriptor().getName().fullName(),
entityBinding.getEntity().getDescriptor().getName().toString(),
idMapper,
propertyMapper,
parentEntityName

View File

@ -60,7 +60,7 @@ public final class BasicMetadataGenerator {
|| "org.hibernate.type.PrimitiveByteArrayBlobType".equals(
hibernateTypeDescriptor.getJavaTypeDescriptor()
.getName()
.fullName()
.toString()
) ) {
if ( parent != null ) {
final boolean addNestedType = !hibernateTypeDescriptor.getTypeParameters().isEmpty();
@ -118,7 +118,7 @@ public final class BasicMetadataGenerator {
typeName = type.getName();
}
if ( typeName == null ) {
typeName = hibernateTypeDescriptor.getJavaTypeDescriptor().getName().fullName();
typeName = hibernateTypeDescriptor.getJavaTypeDescriptor().getName().toString();
}
return typeName;
}

View File

@ -640,7 +640,7 @@ public final class CollectionMetadataGenerator {
}
// Collection of embeddable elements.
final Class componentClass = ReflectionTools.loadClass(
hibernateTypeDescriptor.getJavaTypeDescriptor().getName().fullName(),
hibernateTypeDescriptor.getJavaTypeDescriptor().getName().toString(),
context.getClassLoaderService()
);
final MiddleEmbeddableComponentMapper componentMapper = new MiddleEmbeddableComponentMapper(

View File

@ -65,7 +65,7 @@ public final class ComponentMetadataGenerator {
} else {
// TODO: get rid of classloading.
componentClass = context.getClassLoaderService().classForName(
compositeAttributeBinding.getHibernateTypeDescriptor().getJavaTypeDescriptor().getName().fullName()
compositeAttributeBinding.getHibernateTypeDescriptor().getJavaTypeDescriptor().getName().toString()
);
}
final CompositeMapperBuilder componentMapper = mapper.addComponent(

View File

@ -42,7 +42,6 @@ import org.hibernate.metamodel.spi.binding.EntityBinding;
import org.hibernate.metamodel.spi.binding.EntityIdentifier;
import org.hibernate.metamodel.spi.binding.ManyToOneAttributeBinding;
import org.hibernate.metamodel.spi.binding.SingularAttributeBinding;
import org.hibernate.metamodel.spi.binding.SingularNonAssociationAttributeBinding;
import org.hibernate.type.ManyToOneType;
import org.hibernate.type.Type;
@ -160,7 +159,7 @@ public final class IdMetadataGenerator {
// Embeddable id
// TODO: get rid of classloading.
final Class embeddableClass = context.getClassLoaderService().classForName(
entityIdentifier.getAttributeBinding().getHibernateTypeDescriptor().getJavaTypeDescriptor().getName().fullName()
entityIdentifier.getAttributeBinding().getHibernateTypeDescriptor().getJavaTypeDescriptor().getName().toString()
);
mapper = new EmbeddedIdMapper( getIdPropertyData( entityIdentifier.getAttributeBinding() ), embeddableClass );
if ( !addIdProperties(
@ -219,7 +218,7 @@ public final class IdMetadataGenerator {
return new IdMappingData( mapper, origIdMapping, relIdMapping );
}
private PropertyData getIdPropertyData(SingularNonAssociationAttributeBinding idAttributeBinding) {
private PropertyData getIdPropertyData(SingularAttributeBinding idAttributeBinding) {
return new PropertyData(
idAttributeBinding.getAttribute().getName(),
idAttributeBinding.getAttribute().getName(),

View File

@ -34,10 +34,6 @@ import org.hibernate.envers.internal.entities.mapper.relation.OneToOneNotOwningM
import org.hibernate.envers.internal.entities.mapper.relation.OneToOnePrimaryKeyJoinColumnMapper;
import org.hibernate.envers.internal.entities.mapper.relation.ToOneIdMapper;
import org.hibernate.envers.internal.tools.MappingTools;
import org.hibernate.mapping.OneToOne;
import org.hibernate.mapping.ToOne;
import org.hibernate.mapping.Value;
import org.hibernate.metamodel.internal.source.annotations.attribute.SingularAssociationAttribute;
import org.hibernate.metamodel.spi.binding.OneToOneAttributeBinding;
import org.hibernate.metamodel.spi.binding.SingularAssociationAttributeBinding;

View File

@ -32,7 +32,7 @@ import org.hibernate.envers.configuration.internal.RevisionInfoConfigurationResu
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.metamodel.Metadata;
import org.hibernate.metamodel.internal.source.annotations.util.JandexHelper;
import org.hibernate.metamodel.source.internal.annotations.util.JandexHelper;
import org.hibernate.metamodel.spi.AdditionalJaxbRootProducer;
import org.hibernate.metamodel.spi.InFlightMetadataCollector;
import org.hibernate.metamodel.spi.binding.EntityBinding;
@ -122,7 +122,7 @@ public class EnversJaxbRootProducer implements AdditionalJaxbRootProducer {
@Override
public ClassInfo getClassInfo(AttributeContainer attributeContainer) {
return getClassInfo(
attributeContainer.getDescriptor().getName().fullName()
attributeContainer.getDescriptor().getName().toString()
);
}

View File

@ -82,7 +82,7 @@ public abstract class MappingTools {
*/
public static boolean ignoreNotFound(AttributeBinding attributeBinding) {
if ( ManyToOneAttributeBinding.class.isInstance( attributeBinding )) {
return ! ( (ManyToOneAttributeBinding) attributeBinding ).isNotFoundAnException();
return ( (ManyToOneAttributeBinding) attributeBinding ).isIgnoreNotFound();
}
else if ( attributeBinding instanceof PluralAttributeBinding ) {
final PluralAttributeBinding pluralAttributeBinding = (PluralAttributeBinding) attributeBinding;