diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/binder/Binder.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/binder/Binder.java index 8e58c07aa9..a52be1bcfa 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/binder/Binder.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/binder/Binder.java @@ -175,6 +175,7 @@ import org.hibernate.type.ForeignKeyDirection; import org.hibernate.type.Type; import org.jboss.jandex.DotName; +import org.jboss.logging.Logger; import static org.hibernate.MultiTenancyStrategy.DISCRIMINATOR; import static org.hibernate.engine.spi.SyntheticAttributeHelper.SYNTHETIC_COMPOSITE_ID_ATTRIBUTE_NAME; @@ -189,6 +190,8 @@ import static org.hibernate.engine.spi.SyntheticAttributeHelper.SYNTHETIC_COMPOS * @author Strong Liu */ public class Binder { + private static final Logger LOG = Logger.getLogger( Binder.class ); + // Entity hierarchies and source index need be available throughout the binding process private final Map entityHierarchiesByRootEntityName = new LinkedHashMap(); @@ -1059,6 +1062,12 @@ public class Binder { // processing entity hierarchies. int oldSize = Integer.MAX_VALUE; while( !unresolvedEntityHierarchies.isEmpty() && unresolvedEntityHierarchies.size() < oldSize ) { + LOG.debug( + String.format( + "Retry resolving remaining unresolved EntityHieraries: %s", + getRootEntityNames( unresolvedEntityHierarchies ) + ) + ); oldSize = unresolvedEntityHierarchies.size(); for ( Iterator it = unresolvedEntityHierarchies.iterator(); it.hasNext(); ) { final EntityHierarchySource entityHierarchySource = it.next(); @@ -1066,26 +1075,44 @@ public class Binder { processHelper.apply( entityHierarchySource, strategy ); // succeeded, so the entityHierarchySource is no longer unresolved. it.remove(); + LOG.debug( + String.format( + "EntityHierarchy [%s] has been resolved", entityHierarchySource.getRoot().getEntityName() + ) + ); } catch (Exception ex) { - // to nothing; + // just log the exception. + LOG.debug( + String.format( + "Could not resolve EntityHierarchy %s due to: [%s]", + entityHierarchySource.getRoot().getEntityName(), + ex + ) + ); } } } // If any entity hierarchies cannot be resolved, then throw exception. if ( ! unresolvedEntityHierarchies.isEmpty() ) { - StringBuilder buffer = new StringBuilder(); - String sep = ""; - for ( EntityHierarchySource unresolved : unresolvedEntityHierarchies ) { - buffer.append( sep ).append( unresolved.getRoot().getEntityName() ); - sep = ", "; - } throw new IllegalStateException( - "Could not resolve all EntityHierarchies; remaining = {" + buffer.toString() + "}" + "Could not resolve all EntityHierarchies; remaining = {" + + getRootEntityNames( unresolvedEntityHierarchies ) + + "}" ); } } + private String getRootEntityNames(Set entityHierarchySources) { + StringBuilder buffer = new StringBuilder(); + String sep = ""; + for ( EntityHierarchySource entityHierarchySource : entityHierarchySources ) { + buffer.append( sep ).append( entityHierarchySource.getRoot().getEntityName() ); + sep = ", "; + } + return buffer.toString(); + } + // TODO: this will not be necessary once we know the proper order for // processing entity hierarchies. private boolean isIdentifierDependentOnOtherEntityHierarchy(EntityHierarchySource entityHierarchySource) { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/binder/RelationalValueBindingHelper.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/binder/RelationalValueBindingHelper.java index 3b6f49f069..d9ffe79115 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/binder/RelationalValueBindingHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/binder/RelationalValueBindingHelper.java @@ -30,6 +30,7 @@ import java.util.List; import org.hibernate.TruthValue; import org.hibernate.cfg.NamingStrategy; import org.hibernate.internal.util.StringHelper; +import org.hibernate.metamodel.source.internal.annotations.attribute.SingularAssociationAttribute; import org.hibernate.metamodel.source.spi.ColumnSource; import org.hibernate.metamodel.source.spi.DerivedValueSource; import org.hibernate.metamodel.source.spi.RelationalValueSource; @@ -93,7 +94,8 @@ public class RelationalValueBindingHelper { final boolean forceNonNullable) { final List valueBindings = new ArrayList(); final NaturalIdMutability naturalIdMutability; - if ( SingularAttributeSource.class.isInstance( valueSourceContainer ) ) { + if ( SingularAttributeSource.class.isInstance( valueSourceContainer ) && + SingularAttributeSource.class.cast( valueSourceContainer ).getNaturalIdMutability() != null ) { naturalIdMutability = SingularAttributeSource.class.cast( valueSourceContainer ).getNaturalIdMutability(); } else { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/internal/annotations/AbstractToOneAttributeSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/internal/annotations/AbstractToOneAttributeSourceImpl.java index 57ad3b4cda..2eb6f88387 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/internal/annotations/AbstractToOneAttributeSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/internal/annotations/AbstractToOneAttributeSourceImpl.java @@ -124,7 +124,9 @@ public abstract class AbstractToOneAttributeSourceImpl extends SingularAttribute @Override public ForeignKeyDirection getForeignKeyDirection() { - return singularAttributeNature == SingularAttributeNature.ONE_TO_ONE && !associationAttribute.isOptional() + return singularAttributeNature == SingularAttributeNature.ONE_TO_ONE && + !associationAttribute.isOptional() && + associationAttribute.getMappedByAttributeName() == null ? ForeignKeyDirection.FROM_PARENT : ForeignKeyDirection.TO_PARENT; } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/internal/annotations/attribute/PluralAttributeElementDetailsEmbedded.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/internal/annotations/attribute/PluralAttributeElementDetailsEmbedded.java index 938b76e478..18cb6f13d7 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/internal/annotations/attribute/PluralAttributeElementDetailsEmbedded.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/internal/annotations/attribute/PluralAttributeElementDetailsEmbedded.java @@ -176,12 +176,12 @@ public class PluralAttributeElementDetailsEmbedded implements PluralAttributeEle @Override public boolean getContainerUpdatability() { - return false; + return true; } @Override public boolean getContainerInsertability() { - return false; + return true; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/internal/annotations/attribute/PluralAttributeIndexDetailsMapKeyEmbedded.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/internal/annotations/attribute/PluralAttributeIndexDetailsMapKeyEmbedded.java index 3e59469164..134bf70da3 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/internal/annotations/attribute/PluralAttributeIndexDetailsMapKeyEmbedded.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/internal/annotations/attribute/PluralAttributeIndexDetailsMapKeyEmbedded.java @@ -104,12 +104,12 @@ public class PluralAttributeIndexDetailsMapKeyEmbedded @Override public boolean getContainerUpdatability() { - return false; + return true; } @Override public boolean getContainerInsertability() { - return false; + return true; } @Override diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/RevisionInfoConfiguration.java b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/RevisionInfoConfiguration.java index 854e852d68..d4b1ed7cce 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/RevisionInfoConfiguration.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/RevisionInfoConfiguration.java @@ -293,6 +293,7 @@ public class RevisionInfoConfiguration { HibernateTypeDescriptor revisionTimestampType = revisionTimestampAttribute.getHibernateTypeDescriptor(); final String revisionTimestampClassName = revisionTimestampType.getJavaTypeDescriptor().getName().toString(); if ( Long.TYPE.getName().equals( revisionTimestampClassName ) || + Long.class.getName().equals( revisionTimestampClassName ) || java.util.Date.class.getName().equals( revisionTimestampClassName ) || Date.class.getName().equals( revisionTimestampClassName) ) { revisionInfoTimestampData = new PropertyData( diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/AuditMetadataGenerator.java b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/AuditMetadataGenerator.java index 0aa6511132..3c13d8929a 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/AuditMetadataGenerator.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/AuditMetadataGenerator.java @@ -30,6 +30,7 @@ import java.util.List; import java.util.Map; import org.hibernate.MappingException; +import org.hibernate.cfg.NotYetImplementedException; import org.hibernate.envers.RelationTargetAuditMode; import org.hibernate.envers.configuration.internal.metadata.reader.ClassAuditingData; import org.hibernate.envers.configuration.internal.metadata.reader.PropertyAuditingData; @@ -294,7 +295,9 @@ public final class AuditMetadataGenerator { } else if ( type instanceof OneToOneType ) { final OneToOneAttributeBinding oneToOneAttributeBinding = (OneToOneAttributeBinding) attributeBinding; - if ( oneToOneAttributeBinding.getReferencedAttributeBinding().getAttribute().getName() != null ) { + if ( oneToOneAttributeBinding.getReferencedAttributeBinding().getAttribute().getName() != null && + !oneToOneAttributeBinding.getReferencedEntityBinding().getHierarchyDetails().getEntityIdentifier() + .isIdentifierAttributeBinding( oneToOneAttributeBinding.getReferencedAttributeBinding() ) ) { toOneRelationMetadataGenerator.addOneToOneNotOwning( propertyAuditingData, oneToOneAttributeBinding, @@ -715,6 +718,10 @@ public final class AuditMetadataGenerator { ); // TODO: add support for joins + if ( !entityBinding.getSecondaryTables().isEmpty() ) { + throw new NotYetImplementedException( "Secondary tables are not supported by envers yet." ); + } + // Creating and mapping joins (first pass) //createJoins( entityBinding, classMapping, auditingData ); //addJoins( entityBinding, propertyMapper, auditingData, entityBinding.getEntityName(), xmlMappingData, true ); diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/reader/AuditedPropertiesReader.java b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/reader/AuditedPropertiesReader.java index 5ea34eaec5..daa8222755 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/reader/AuditedPropertiesReader.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/reader/AuditedPropertiesReader.java @@ -57,6 +57,7 @@ import org.hibernate.metamodel.spi.binding.EmbeddedAttributeBinding; import org.hibernate.metamodel.spi.binding.EntityBinding; import org.hibernate.metamodel.spi.domain.Attribute; import org.hibernate.metamodel.spi.domain.Hierarchical; +import org.hibernate.metamodel.spi.domain.MappedSuperclass; import org.jboss.jandex.AnnotationInstance; import org.jboss.jandex.ClassInfo; @@ -398,10 +399,16 @@ public class AuditedPropertiesReader { addFromProperties( getAttributeBindings( attributeBindingContainer, "property" ), "property", propertyAccessedPersistentProperties, allClassAudited ); if ( allClassAudited != null || !auditedPropertiesHolder.isEmpty() ) { - if ( EntityBinding.class.isInstance( attributeBindingContainer ) ) { - final EntityBinding entityBinding = (EntityBinding) attributeBindingContainer; - if ( entityBinding.getSuperEntityBinding() != null ) { - addPropertiesFromClass( entityBinding.getSuperEntityBinding() ); + if ( Hierarchical.class.isInstance( attributeBindingContainer.getAttributeContainer() ) ) { + final Hierarchical hierarchical = (Hierarchical) attributeBindingContainer.getAttributeContainer(); + if ( MappedSuperclass.class.isInstance( hierarchical.getSuperType() ) ) { + throw new NotYetImplementedException( "@MappedSuperclass not supported with new metamodel by envers yet. " ); + } + else if ( EntityBinding.class.isInstance( attributeBindingContainer ) ) { + final EntityBinding entityBinding = (EntityBinding) attributeBindingContainer; + if ( entityBinding.getSuperEntityBinding() != null ) { + addPropertiesFromClass( entityBinding.getSuperEntityBinding() ); + } } } } diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/internal/tools/Tools.java b/hibernate-envers/src/main/java/org/hibernate/envers/internal/tools/Tools.java index 830d6d4b96..b4ef5ab7cb 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/internal/tools/Tools.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/internal/tools/Tools.java @@ -121,7 +121,7 @@ public abstract class Tools { else { throw new AssertionFailure( "Unexpected annotation target " + target.toString() ); } - return enclosingClass.equals( clazz ) || jandexIndex.getAllKnownSubclasses( clazz.name() ).contains( enclosingClass ); + return enclosingClass.equals( clazz ) || jandexIndex.getAllKnownSubclasses( enclosingClass.name() ).contains( clazz ); } } diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/BaseEnversJPAFunctionalTestCase.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/BaseEnversJPAFunctionalTestCase.java index f2c31bc98b..f575367972 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/BaseEnversJPAFunctionalTestCase.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/BaseEnversJPAFunctionalTestCase.java @@ -34,7 +34,6 @@ import java.util.Map; import org.jboss.logging.Logger; import org.hibernate.boot.registry.internal.StandardServiceRegistryImpl; -import org.hibernate.cfg.Configuration; import org.hibernate.dialect.Dialect; import org.hibernate.dialect.H2Dialect; import org.hibernate.engine.transaction.internal.jta.JtaStatusHelper; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/entities/components/Component4.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/entities/components/Component4.java index e18bc7e329..6acd4dfa90 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/entities/components/Component4.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/entities/components/Component4.java @@ -77,7 +77,6 @@ public class Component4 { public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((description == null) ? 0 : description.hashCode()); result = prime * result + ((key == null) ? 0 : key.hashCode()); result = prime * result + ((value == null) ? 0 : value.hashCode()); return result; @@ -94,9 +93,6 @@ public class Component4 { Component4 other = (Component4) obj; - if ( description != null ? !description.equals( other.description ) : other.description != null ) { - return false; - } if ( key != null ? !key.equals( other.key ) : other.key != null ) { return false; } diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/accesstype/MixedAccessType.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/accesstype/MixedAccessType.java index 16da037d15..7f1d59a71c 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/accesstype/MixedAccessType.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/accesstype/MixedAccessType.java @@ -28,12 +28,14 @@ import java.util.Arrays; import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase; import org.hibernate.envers.test.Priority; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.junit.Test; /** * @author Adam Warski (adam at warski dot org) */ +@FailureExpectedWithNewMetamodel( message = "Building SessionFactory for envers with LenientPersistentAttributeMemberResolver.INSTANCE is not supported yet.") public class MixedAccessType extends BaseEnversJPAFunctionalTestCase { private Integer id1; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/basic/ClassicQueryTranslatorFactoryTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/basic/ClassicQueryTranslatorFactoryTest.java index 96baa4f113..8ed4183d8a 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/basic/ClassicQueryTranslatorFactoryTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/basic/ClassicQueryTranslatorFactoryTest.java @@ -25,9 +25,12 @@ package org.hibernate.envers.test.integration.basic; import java.util.Map; +import org.junit.Test; + import org.hibernate.cfg.Environment; import org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.TestForIssue; /** @@ -40,4 +43,16 @@ public class ClassicQueryTranslatorFactoryTest extends Simple { super.addConfigOptions( options ); options.put( Environment.QUERY_TRANSLATOR, ClassicQueryTranslatorFactory.class.getName() ); } + + @Test + @FailureExpectedWithNewMetamodel( message = "ClassicQueryTranslatorFactoryTest confuses package name with an alias" ) + public void testHistoryOfId1() { + super.testHistoryOfId1(); + } + + @Test + @FailureExpectedWithNewMetamodel( message = "ClassicQueryTranslatorFactoryTest confuses package name with an alias" ) + public void testRevisionsCounts() { + super.testRevisionsCounts(); + } } diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/collection/EnumSet.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/collection/EnumSet.java index 370a9e10af..a798e87a75 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/collection/EnumSet.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/collection/EnumSet.java @@ -37,6 +37,7 @@ import org.hibernate.envers.test.tools.TestTools; import org.junit.Assert; import org.junit.Test; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.TestForIssue; /** @@ -114,6 +115,7 @@ public class EnumSet extends BaseEnversJPAFunctionalTestCase { @Test @TestForIssue(jiraKey = "HHH-7780") + @FailureExpectedWithNewMetamodel( message = "Enum attributes represented by String not supported yet." ) public void testEnumRepresentation() { EntityManager entityManager = getEntityManager(); List enums1 = entityManager.createNativeQuery( diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/components/collections/CollectionOfComponents.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/components/collections/CollectionOfComponents.java index ad5645ef17..aff4e571d8 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/components/collections/CollectionOfComponents.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/components/collections/CollectionOfComponents.java @@ -50,7 +50,7 @@ public class CollectionOfComponents extends BaseEnversJPAFunctionalTestCase { @Override protected Class[] getAnnotatedClasses() { - return new Class[] {ComponentSetTestEntity.class}; + return new Class[] {ComponentSetTestEntity.class, Component1.class }; } @Test diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/entityNames/oneToManyNotAudited/ReadEntityWithAuditedCollectionTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/entityNames/oneToManyNotAudited/ReadEntityWithAuditedCollectionTest.java index 2e59e9218d..b70ff466c5 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/entityNames/oneToManyNotAudited/ReadEntityWithAuditedCollectionTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/entityNames/oneToManyNotAudited/ReadEntityWithAuditedCollectionTest.java @@ -9,12 +9,14 @@ import java.util.List; import org.hibernate.MappingException; import org.hibernate.envers.test.AbstractOneSessionTest; import org.hibernate.envers.test.Priority; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.junit.Test; /** * @author Hernán Chanfreau */ +@FailureExpectedWithNewMetamodel( message = "hbm.xml source not supported because it is not indexed." ) public class ReadEntityWithAuditedCollectionTest extends AbstractOneSessionTest { private long id_car1; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/ids/CompositeIds.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/ids/CompositeIds.java index 42055b491f..243f978042 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/ids/CompositeIds.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/ids/CompositeIds.java @@ -35,12 +35,14 @@ import org.hibernate.envers.test.entities.ids.EmbIdWithCustomType; import org.hibernate.envers.test.entities.ids.EmbIdWithCustomTypeTestEntity; import org.hibernate.envers.test.entities.ids.MulId; import org.hibernate.envers.test.entities.ids.MulIdTestEntity; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.junit.Test; /** * @author Adam Warski (adam at warski dot org) */ +@FailureExpectedWithNewMetamodel( message = "Custom types not supported by envers yet." ) public class CompositeIds extends BaseEnversJPAFunctionalTestCase { private EmbId id1; private EmbId id2; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/ids/idclass/IdClassWithRelationTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/ids/idclass/IdClassWithRelationTest.java index 7395f699a0..a03b34fa4c 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/ids/idclass/IdClassWithRelationTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/ids/idclass/IdClassWithRelationTest.java @@ -9,12 +9,14 @@ import org.hibernate.envers.test.Priority; import org.junit.Test; import junit.framework.Assert; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.TestForIssue; /** * @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com) */ @TestForIssue(jiraKey = "HHH-4751") +@FailureExpectedWithNewMetamodel( message = "@IdClass with association not supported yet.") public class IdClassWithRelationTest extends BaseEnversJPAFunctionalTestCase { private RelationalClassId entityId = null; private String typeId = null; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/primarykeyjoin/ChildPrimaryKeyJoinAuditing.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/primarykeyjoin/ChildPrimaryKeyJoinAuditing.java index b50a3aba03..cb3a099baa 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/primarykeyjoin/ChildPrimaryKeyJoinAuditing.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/primarykeyjoin/ChildPrimaryKeyJoinAuditing.java @@ -31,6 +31,7 @@ import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase; import org.hibernate.envers.test.Priority; import org.hibernate.envers.test.integration.inheritance.joined.ParentEntity; import org.hibernate.metamodel.spi.relational.Column; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.junit.Assert; import org.junit.Test; @@ -98,6 +99,7 @@ public class ChildPrimaryKeyJoinAuditing extends BaseEnversJPAFunctionalTestCase } @Test + @FailureExpectedWithNewMetamodel( message = "@PrimaryKeyJoinColumn does not work on sub-entity." ) public void testChildIdColumnName() { Assert.assertEquals( "other_id", diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/inheritance/mixed/MixedInheritanceStrategiesEntityTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/inheritance/mixed/MixedInheritanceStrategiesEntityTest.java index 86ef3e96df..4934b69316 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/inheritance/mixed/MixedInheritanceStrategiesEntityTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/inheritance/mixed/MixedInheritanceStrategiesEntityTest.java @@ -10,6 +10,7 @@ import org.hibernate.envers.test.integration.inheritance.mixed.entities.Activity import org.hibernate.envers.test.integration.inheritance.mixed.entities.ActivityId; import org.hibernate.envers.test.integration.inheritance.mixed.entities.CheckInActivity; import org.hibernate.envers.test.integration.inheritance.mixed.entities.NormalActivity; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.junit.Test; @@ -18,6 +19,7 @@ import static org.junit.Assert.assertEquals; /** * @author Michal Skowronek (mskowr at o2 pl) */ +@FailureExpectedWithNewMetamodel( message = "Secondary tables are not supported by envers yet.") public class MixedInheritanceStrategiesEntityTest extends BaseEnversJPAFunctionalTestCase { private ActivityId id2; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/discriminatorformula/DiscriminatorFormulaTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/discriminatorformula/DiscriminatorFormulaTest.java index 99d998f825..ec05138be7 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/discriminatorformula/DiscriminatorFormulaTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/discriminatorformula/DiscriminatorFormulaTest.java @@ -92,7 +92,6 @@ public class DiscriminatorFormulaTest extends BaseEnversJPAFunctionalTestCase { assert entityDiscriminator.getRelationalValue().getValueType() == Value.ValueType.DERIVED_VALUE; DerivedValue derivedValue = (DerivedValue) entityDiscriminator.getRelationalValue(); Assert.assertEquals( ParentEntity.DISCRIMINATOR_QUERY, derivedValue.getExpression() ); - assert false; } @Test diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/inheritance/tableperclass/abstractparent/AuditedAbstractParentTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/inheritance/tableperclass/abstractparent/AuditedAbstractParentTest.java index 344cefa1e0..64f87cea1d 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/inheritance/tableperclass/abstractparent/AuditedAbstractParentTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/inheritance/tableperclass/abstractparent/AuditedAbstractParentTest.java @@ -42,7 +42,8 @@ public class AuditedAbstractParentTest extends BaseEnversJPAFunctionalTestCase { for ( Schema schema : getMetadata().getDatabase().getSchemas() ) { for ( TableSpecification table : schema.getTables() ) { if ( "AbstractEntity_AUD".equals( table.getLogicalName().getText() ) ) { - Assert.assertFalse( Table.class.isInstance( table ) ); + Assert.assertTrue( Table.class.isInstance( table ) ); + Assert.assertFalse( Table.class.cast( table ).isPhysicalTable() ); return; } } diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/manytomany/BasicWhereJoinTable.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/manytomany/BasicWhereJoinTable.java index ec1936156d..a193e5b631 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/manytomany/BasicWhereJoinTable.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/manytomany/BasicWhereJoinTable.java @@ -31,6 +31,7 @@ import org.hibernate.envers.test.Priority; import org.hibernate.envers.test.entities.IntNoAutoIdTestEntity; import org.hibernate.envers.test.entities.manytomany.WhereJoinTableEntity; import org.hibernate.envers.test.tools.TestTools; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.junit.Test; @@ -140,6 +141,7 @@ public class BasicWhereJoinTable extends BaseEnversJPAFunctionalTestCase { } @Test + @FailureExpectedWithNewMetamodel( message = "@WhereJoinTable is not supported with new metamodel yet." ) public void testHistoryOfWjte1() { IntNoAutoIdTestEntity ite1_1 = getEntityManager().find( IntNoAutoIdTestEntity.class, ite1_1_id ); IntNoAutoIdTestEntity ite2_1 = getEntityManager().find( IntNoAutoIdTestEntity.class, ite2_1_id ); @@ -163,6 +165,7 @@ public class BasicWhereJoinTable extends BaseEnversJPAFunctionalTestCase { } @Test + @FailureExpectedWithNewMetamodel( message = "@WhereJoinTable is not supported with new metamodel yet." ) public void testHistoryOfWjte2() { IntNoAutoIdTestEntity ite1_1 = getEntityManager().find( IntNoAutoIdTestEntity.class, ite1_1_id ); IntNoAutoIdTestEntity ite1_2 = getEntityManager().find( IntNoAutoIdTestEntity.class, ite1_2_id ); diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/manytomany/biowned/BasicBiowned.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/manytomany/biowned/BasicBiowned.java index 1b964a042d..7fe01eedfa 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/manytomany/biowned/BasicBiowned.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/manytomany/biowned/BasicBiowned.java @@ -31,6 +31,7 @@ import org.hibernate.envers.test.Priority; import org.hibernate.envers.test.entities.manytomany.biowned.ListBiowning1Entity; import org.hibernate.envers.test.entities.manytomany.biowned.ListBiowning2Entity; import org.hibernate.envers.test.tools.TestTools; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.junit.Test; @@ -153,6 +154,7 @@ public class BasicBiowned extends BaseEnversJPAFunctionalTestCase { } @Test + @FailureExpectedWithNewMetamodel( message = "Revision query is wrong for bidirectional many-to-many when both sides are owners." ) public void testHistoryOfO1_1() { ListBiowning2Entity o2_1 = getEntityManager().find( ListBiowning2Entity.class, o2_1_id ); ListBiowning2Entity o2_2 = getEntityManager().find( ListBiowning2Entity.class, o2_2_id ); @@ -171,6 +173,7 @@ public class BasicBiowned extends BaseEnversJPAFunctionalTestCase { } @Test + @FailureExpectedWithNewMetamodel( message = "Revision query is wrong for bidirectional many-to-many when both sides are owners." ) public void testHistoryOfO1_2() { ListBiowning2Entity o2_1 = getEntityManager().find( ListBiowning2Entity.class, o2_1_id ); ListBiowning2Entity o2_2 = getEntityManager().find( ListBiowning2Entity.class, o2_2_id ); @@ -189,6 +192,7 @@ public class BasicBiowned extends BaseEnversJPAFunctionalTestCase { } @Test + @FailureExpectedWithNewMetamodel( message = "Revision query is wrong for bidirectional many-to-many when both sides are owners." ) public void testHistoryOfO2_1() { ListBiowning1Entity o1_1 = getEntityManager().find( ListBiowning1Entity.class, o1_1_id ); ListBiowning1Entity o1_2 = getEntityManager().find( ListBiowning1Entity.class, o1_2_id ); @@ -207,6 +211,7 @@ public class BasicBiowned extends BaseEnversJPAFunctionalTestCase { } @Test + @FailureExpectedWithNewMetamodel( message = "Revision query is wrong for bidirectional many-to-many when both sides are owners." ) public void testHistoryOfO2_2() { ListBiowning1Entity o1_1 = getEntityManager().find( ListBiowning1Entity.class, o1_1_id ); ListBiowning1Entity o1_2 = getEntityManager().find( ListBiowning1Entity.class, o1_2_id ); diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/manytomany/sametable/BasicSametable.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/manytomany/sametable/BasicSametable.java index b4b3e1483a..367f327fd5 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/manytomany/sametable/BasicSametable.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/manytomany/sametable/BasicSametable.java @@ -34,6 +34,7 @@ import org.hibernate.envers.test.entities.manytomany.sametable.Child1Entity; import org.hibernate.envers.test.entities.manytomany.sametable.Child2Entity; import org.hibernate.envers.test.entities.manytomany.sametable.ParentEntity; import org.hibernate.envers.test.tools.TestTools; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.junit.Assert; import org.junit.Test; @@ -188,6 +189,7 @@ public class BasicSametable extends BaseEnversJPAFunctionalTestCase { } @Test + @FailureExpectedWithNewMetamodel( message = "@WhereJoinTable is not supported with new metamodel yet." ) public void testHistoryOfParent1() { Child1Entity c1_1 = getEntityManager().find( Child1Entity.class, c1_1_id ); Child1Entity c1_2 = getEntityManager().find( Child1Entity.class, c1_2_id ); @@ -213,6 +215,7 @@ public class BasicSametable extends BaseEnversJPAFunctionalTestCase { } @Test + @FailureExpectedWithNewMetamodel( message = "@WhereJoinTable is not supported with new metamodel yet." ) public void testHistoryOfParent2() { Child1Entity c1_1 = getEntityManager().find( Child1Entity.class, c1_1_id ); Child2Entity c2_1 = getEntityManager().find( Child2Entity.class, c2_1_id ); @@ -238,6 +241,7 @@ public class BasicSametable extends BaseEnversJPAFunctionalTestCase { } @Test + @FailureExpectedWithNewMetamodel( message = "@WhereJoinTable is not supported with new metamodel yet." ) public void testHistoryOfChild1_1() { ParentEntity p1 = getEntityManager().find( ParentEntity.class, p1_id ); ParentEntity p2 = getEntityManager().find( ParentEntity.class, p2_id ); @@ -257,6 +261,7 @@ public class BasicSametable extends BaseEnversJPAFunctionalTestCase { // TODO: was disabled? @Test + @FailureExpectedWithNewMetamodel( message = "@WhereJoinTable is not supported with new metamodel yet." ) public void testHistoryOfChild1_2() { ParentEntity p1 = getEntityManager().find( ParentEntity.class, p1_id ); @@ -274,6 +279,7 @@ public class BasicSametable extends BaseEnversJPAFunctionalTestCase { } @Test + @FailureExpectedWithNewMetamodel( message = "@WhereJoinTable is not supported with new metamodel yet." ) public void testHistoryOfChild2_1() { ParentEntity p2 = getEntityManager().find( ParentEntity.class, p2_id ); @@ -291,6 +297,7 @@ public class BasicSametable extends BaseEnversJPAFunctionalTestCase { } @Test + @FailureExpectedWithNewMetamodel( message = "@WhereJoinTable is not supported with new metamodel yet." ) public void testHistoryOfChild2_2() { ParentEntity p1 = getEntityManager().find( ParentEntity.class, p1_id ); ParentEntity p2 = getEntityManager().find( ParentEntity.class, p2_id ); diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/manytoone/bidirectional/ImplicitMappedByTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/manytoone/bidirectional/ImplicitMappedByTest.java index d4b3bfc187..cef69d2274 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/manytoone/bidirectional/ImplicitMappedByTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/manytoone/bidirectional/ImplicitMappedByTest.java @@ -12,12 +12,14 @@ import org.hibernate.envers.test.tools.TestTools; import org.junit.Assert; import org.junit.Test; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.TestForIssue; /** * @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com) */ @TestForIssue(jiraKey = "HHH-4962") +@FailureExpectedWithNewMetamodel( message = "Secondary tables are not supported by envers yet.") public class ImplicitMappedByTest extends BaseEnversJPAFunctionalTestCase { private Long ownedId = null; private Long owning1Id = null; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/naming/VersionsJoinTableRangeComponentNamingTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/naming/VersionsJoinTableRangeComponentNamingTest.java index 2c1b8278eb..0de396e162 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/naming/VersionsJoinTableRangeComponentNamingTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/naming/VersionsJoinTableRangeComponentNamingTest.java @@ -34,6 +34,7 @@ import org.hibernate.envers.test.entities.components.Component1; import org.hibernate.metamodel.spi.binding.EntityBinding; import org.hibernate.metamodel.spi.relational.Column; import org.hibernate.metamodel.spi.relational.Value; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.junit.Test; @@ -43,6 +44,7 @@ import org.junit.Test; * * @author Erik-Berndt Scheper */ +@FailureExpectedWithNewMetamodel( message = "Assocation with generic type that extends @MappedSuperclass is not supported yet.") public class VersionsJoinTableRangeComponentNamingTest extends BaseEnversJPAFunctionalTestCase { private Integer vjrcte_id; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/naming/quotation/QuotedFieldsTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/naming/quotation/QuotedFieldsTest.java index 2b9c7ee4d6..56a0cdf0f1 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/naming/quotation/QuotedFieldsTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/naming/quotation/QuotedFieldsTest.java @@ -82,9 +82,9 @@ public class QuotedFieldsTest extends BaseEnversJPAFunctionalTestCase { TableSpecification table = getMetadata().getEntityBinding( "org.hibernate.envers.test.integration.naming.quotation.QuotedFieldsEntity_AUD" ).getPrimaryTable(); - Column column1 = table.locateColumn( "id" ); - Column column2 = table.locateColumn( "data1" ); - Column column3 = table.locateColumn( "data2" ); + Column column1 = table.locateColumn( "`id`" ); + Column column2 = table.locateColumn( "`data1`" ); + Column column3 = table.locateColumn( "`data2`" ); assert column1 != null; assert column2 != null; assert column3 != null; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/onetomany/embeddedid/MapsIdTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/onetomany/embeddedid/MapsIdTest.java index 115d61b1c9..2f86eb59b8 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/onetomany/embeddedid/MapsIdTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/onetomany/embeddedid/MapsIdTest.java @@ -9,12 +9,14 @@ import org.hibernate.envers.test.Priority; import org.junit.Assert; import org.junit.Test; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.TestForIssue; /** * @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com) */ @TestForIssue(jiraKey = "HHH-7157") +@FailureExpectedWithNewMetamodel( message = "@MapsId is not supported yet." ) public class MapsIdTest extends BaseEnversJPAFunctionalTestCase { private PersonTuple tuple1Ver1 = null; private PersonTuple tuple2Ver1 = null; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/onetomany/hierarchy/HierarchyTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/onetomany/hierarchy/HierarchyTest.java index 924cd3206a..eae2baab33 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/onetomany/hierarchy/HierarchyTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/onetomany/hierarchy/HierarchyTest.java @@ -10,12 +10,14 @@ import org.hibernate.envers.test.tools.TestTools; import org.junit.Assert; import org.junit.Test; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.TestForIssue; /** * @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com) */ @TestForIssue(jiraKey = "HHH-6661") +@FailureExpectedWithNewMetamodel( message = "Secondary tables are not supported by envers yet.") public class HierarchyTest extends BaseEnversJPAFunctionalTestCase { private Long parentId = null; private Long child1Id = null; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/primarykeyjoincolumn/OneToOneWithPrimaryKeyJoinTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/primarykeyjoincolumn/OneToOneWithPrimaryKeyJoinTest.java index 7aea79eb2b..b7b88cf600 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/primarykeyjoincolumn/OneToOneWithPrimaryKeyJoinTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/primarykeyjoincolumn/OneToOneWithPrimaryKeyJoinTest.java @@ -12,6 +12,7 @@ import org.hibernate.proxy.HibernateProxy; import org.junit.Assert; import org.junit.Test; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.TestForIssue; /** @@ -85,6 +86,7 @@ public class OneToOneWithPrimaryKeyJoinTest extends BaseEnversJPAFunctionalTestC } @Test + @FailureExpectedWithNewMetamodel( message = "@OneToOne @PrimaryKeyJoinColumn querying is not working." ) public void testHistoryOfPerson() { Person personVer1 = new Person( personId, "Robert" ); Account accountVer1 = new Account( accountId, "Saving" ); @@ -103,6 +105,7 @@ public class OneToOneWithPrimaryKeyJoinTest extends BaseEnversJPAFunctionalTestC } @Test + @FailureExpectedWithNewMetamodel( message = "@OneToOne @PrimaryKeyJoinColumn querying is not working." ) public void testHistoryOfAccount() { Person personVer1 = new Person( personId, "Robert" ); Account accountVer1 = new Account( accountId, "Saving" ); @@ -121,6 +124,7 @@ public class OneToOneWithPrimaryKeyJoinTest extends BaseEnversJPAFunctionalTestC } @Test + @FailureExpectedWithNewMetamodel( message = "@OneToOne @PrimaryKeyJoinColumn querying is not working." ) public void testHistoryOfAccountNotAuditedOwners() { NotAuditedNoProxyPerson noProxyPersonVer1 = new NotAuditedNoProxyPerson( noProxyPersonId, "Kinga" ); NotAuditedProxyPerson proxyPersonVer1 = new NotAuditedProxyPerson( proxyPersonId, "Lukasz" ); diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/query/SimpleQuery.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/query/SimpleQuery.java index 030d65a1ea..96c46a26c7 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/query/SimpleQuery.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/query/SimpleQuery.java @@ -41,6 +41,7 @@ import org.hibernate.envers.test.entities.ids.EmbIdTestEntity; import org.hibernate.envers.test.entities.ids.MulId; import org.hibernate.envers.test.entities.ids.MulIdTestEntity; import org.hibernate.envers.test.tools.TestTools; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.TestForIssue; import org.junit.Assert; import org.junit.Test; @@ -437,6 +438,7 @@ public class SimpleQuery extends BaseEnversJPAFunctionalTestCase { @Test @TestForIssue(jiraKey = "HHH-8567") + @FailureExpectedWithNewMetamodel( message = "Revision query with restriction on @IdClass attributes is broken." ) public void testMultipleIdPropertyRestriction() { MulIdTestEntity ver2 = (MulIdTestEntity) getAuditReader().createQuery() .forEntitiesAtRevision( MulIdTestEntity.class, 2 ) diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/reventity/LongRevEntityInheritanceChildAuditing.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/reventity/LongRevEntityInheritanceChildAuditing.java index 3970f481a8..2df00c1dd9 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/reventity/LongRevEntityInheritanceChildAuditing.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/reventity/LongRevEntityInheritanceChildAuditing.java @@ -30,6 +30,7 @@ import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase; import org.hibernate.envers.test.integration.inheritance.joined.ChildEntity; import org.hibernate.envers.test.integration.inheritance.joined.ParentEntity; import org.hibernate.metamodel.spi.relational.Value; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.junit.Test; @@ -41,6 +42,7 @@ import static org.junit.Assert.assertEquals; * * @author Adam Warski (adam at warski dot org) */ +@FailureExpectedWithNewMetamodel( message = "Entity subclass has wrong ID type" ) public class LongRevEntityInheritanceChildAuditing extends BaseEnversJPAFunctionalTestCase { @Override protected Class[] getAnnotatedClasses() { diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/secondary/BasicSecondary.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/secondary/BasicSecondary.java index f9440e4b7c..9422c72f8f 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/secondary/BasicSecondary.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/secondary/BasicSecondary.java @@ -31,12 +31,14 @@ import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase; import org.hibernate.envers.test.Priority; import org.hibernate.metamodel.spi.binding.SecondaryTable; import org.hibernate.metamodel.spi.relational.Identifier; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.junit.Test; /** * @author Adam Warski (adam at warski dot org) */ +@FailureExpectedWithNewMetamodel( message = "Secondary tables are not supported by envers yet.") public class BasicSecondary extends BaseEnversJPAFunctionalTestCase { private Integer id; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/secondary/NamingSecondary.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/secondary/NamingSecondary.java index 43c5b55937..287efc22cc 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/secondary/NamingSecondary.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/secondary/NamingSecondary.java @@ -28,12 +28,14 @@ import java.util.Arrays; import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase; import org.hibernate.envers.test.Priority; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.junit.Test; /** * @author Adam Warski (adam at warski dot org) */ +@FailureExpectedWithNewMetamodel( message = "Secondary tables are not supported by envers yet.") public class NamingSecondary extends BaseEnversJPAFunctionalTestCase { private Integer id; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/EmbIdSecondary.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/EmbIdSecondary.java index 91da2adbfb..e8b81fcbfc 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/EmbIdSecondary.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/EmbIdSecondary.java @@ -29,12 +29,14 @@ import java.util.Arrays; import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase; import org.hibernate.envers.test.Priority; import org.hibernate.envers.test.entities.ids.EmbId; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.junit.Test; /** * @author Adam Warski (adam at warski dot org) */ +@FailureExpectedWithNewMetamodel( message = "Secondary tables are not supported by envers yet.") public class EmbIdSecondary extends BaseEnversJPAFunctionalTestCase { private EmbId id; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/MulIdSecondary.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/MulIdSecondary.java index 2ac4775680..89c03e6a7a 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/MulIdSecondary.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/MulIdSecondary.java @@ -25,18 +25,18 @@ package org.hibernate.envers.test.integration.secondary.ids; import javax.persistence.EntityManager; import java.util.Arrays; -import java.util.Iterator; import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase; import org.hibernate.envers.test.Priority; import org.hibernate.envers.test.entities.ids.MulId; -import org.hibernate.mapping.Join; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.junit.Test; /** * @author Adam Warski (adam at warski dot org) */ +@FailureExpectedWithNewMetamodel( message = "Secondary tables are not supported by envers yet.") public class MulIdSecondary extends BaseEnversJPAFunctionalTestCase { private MulId id; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/strategy/ValidityAuditStrategyRevEndTestCustomRevEnt.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/strategy/ValidityAuditStrategyRevEndTestCustomRevEnt.java index af4c2943f1..fecc7eee87 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/strategy/ValidityAuditStrategyRevEndTestCustomRevEnt.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/strategy/ValidityAuditStrategyRevEndTestCustomRevEnt.java @@ -43,6 +43,7 @@ import org.hibernate.envers.test.entities.manytomany.sametable.Child2Entity; import org.hibernate.envers.test.entities.manytomany.sametable.ParentEntity; import org.hibernate.envers.test.entities.reventity.CustomDateRevEntity; import org.hibernate.envers.test.tools.TestTools; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.junit.Test; @@ -276,6 +277,7 @@ public class ValidityAuditStrategyRevEndTestCustomRevEnt extends BaseEnversJPAFu } @Test + @FailureExpectedWithNewMetamodel( message = "@WhereJoinTable is not supported with new metamodel yet." ) public void testHistoryOfParent1() { Child1Entity c1_1 = getEntityManager() @@ -305,6 +307,7 @@ public class ValidityAuditStrategyRevEndTestCustomRevEnt extends BaseEnversJPAFu } @Test + @FailureExpectedWithNewMetamodel( message = "@WhereJoinTable is not supported with new metamodel yet." ) public void testHistoryOfParent2() { Child1Entity c1_1 = getEntityManager() .find( Child1Entity.class, c1_1_id ); @@ -333,6 +336,7 @@ public class ValidityAuditStrategyRevEndTestCustomRevEnt extends BaseEnversJPAFu } @Test + @FailureExpectedWithNewMetamodel( message = "@WhereJoinTable is not supported with new metamodel yet." ) public void testHistoryOfChild1_1() { ParentEntity p1 = getEntityManager().find( ParentEntity.class, p1_id ); ParentEntity p2 = getEntityManager().find( ParentEntity.class, p2_id ); @@ -367,6 +371,7 @@ public class ValidityAuditStrategyRevEndTestCustomRevEnt extends BaseEnversJPAFu // TODO: this was disabled? @Test + @FailureExpectedWithNewMetamodel( message = "@WhereJoinTable is not supported with new metamodel yet." ) public void testHistoryOfChild1_2() { ParentEntity p1 = getEntityManager().find( ParentEntity.class, p1_id ); @@ -399,6 +404,7 @@ public class ValidityAuditStrategyRevEndTestCustomRevEnt extends BaseEnversJPAFu } @Test + @FailureExpectedWithNewMetamodel( message = "@WhereJoinTable is not supported with new metamodel yet." ) public void testHistoryOfChild2_1() { ParentEntity p2 = getEntityManager().find( ParentEntity.class, p2_id ); @@ -431,6 +437,7 @@ public class ValidityAuditStrategyRevEndTestCustomRevEnt extends BaseEnversJPAFu } @Test + @FailureExpectedWithNewMetamodel( message = "@WhereJoinTable is not supported with new metamodel yet." ) public void testHistoryOfChild2_2() { ParentEntity p1 = getEntityManager().find( ParentEntity.class, p1_id ); ParentEntity p2 = getEntityManager().find( ParentEntity.class, p2_id ); diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/strategy/ValidityAuditStrategyRevEndTsTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/strategy/ValidityAuditStrategyRevEndTsTest.java index 95491e1cda..08a282786f 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/strategy/ValidityAuditStrategyRevEndTsTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/strategy/ValidityAuditStrategyRevEndTsTest.java @@ -45,6 +45,7 @@ import org.hibernate.envers.test.entities.manytomany.sametable.Child1Entity; import org.hibernate.envers.test.entities.manytomany.sametable.Child2Entity; import org.hibernate.envers.test.entities.manytomany.sametable.ParentEntity; import org.hibernate.envers.test.tools.TestTools; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.junit.Assert; import org.junit.Test; @@ -274,6 +275,7 @@ public class ValidityAuditStrategyRevEndTsTest extends BaseEnversJPAFunctionalTe } @Test + @FailureExpectedWithNewMetamodel( message = "@WhereJoinTable is not supported with new metamodel yet." ) public void testHistoryOfParent1() { Child1Entity c1_1 = getEntityManager() @@ -303,6 +305,7 @@ public class ValidityAuditStrategyRevEndTsTest extends BaseEnversJPAFunctionalTe } @Test + @FailureExpectedWithNewMetamodel( message = "@WhereJoinTable is not supported with new metamodel yet." ) public void testHistoryOfParent2() { Child1Entity c1_1 = getEntityManager() .find( Child1Entity.class, c1_1_id ); @@ -331,6 +334,7 @@ public class ValidityAuditStrategyRevEndTsTest extends BaseEnversJPAFunctionalTe } @Test + @FailureExpectedWithNewMetamodel( message = "@WhereJoinTable is not supported with new metamodel yet." ) public void testHistoryOfChild1_1() { ParentEntity p1 = getEntityManager().find( ParentEntity.class, p1_id ); ParentEntity p2 = getEntityManager().find( ParentEntity.class, p2_id ); @@ -365,6 +369,7 @@ public class ValidityAuditStrategyRevEndTsTest extends BaseEnversJPAFunctionalTe // TODO: this was disabled? @Test + @FailureExpectedWithNewMetamodel( message = "@WhereJoinTable is not supported with new metamodel yet." ) public void testHistoryOfChild1_2() { ParentEntity p1 = getEntityManager().find( ParentEntity.class, p1_id ); @@ -397,6 +402,7 @@ public class ValidityAuditStrategyRevEndTsTest extends BaseEnversJPAFunctionalTe } @Test + @FailureExpectedWithNewMetamodel( message = "@WhereJoinTable is not supported with new metamodel yet." ) public void testHistoryOfChild2_1() { ParentEntity p2 = getEntityManager().find( ParentEntity.class, p2_id ); @@ -429,6 +435,7 @@ public class ValidityAuditStrategyRevEndTsTest extends BaseEnversJPAFunctionalTe } @Test + @FailureExpectedWithNewMetamodel( message = "@WhereJoinTable is not supported with new metamodel yet." ) public void testHistoryOfChild2_2() { ParentEntity p1 = getEntityManager().find( ParentEntity.class, p1_id ); ParentEntity p2 = getEntityManager().find( ParentEntity.class, p2_id ); diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditAtMethodSuperclassLevel/auditAllSubclass/MappedSubclassingAllAuditedTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditAtMethodSuperclassLevel/auditAllSubclass/MappedSubclassingAllAuditedTest.java index eb8f62e86f..2e6090f4e7 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditAtMethodSuperclassLevel/auditAllSubclass/MappedSubclassingAllAuditedTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditAtMethodSuperclassLevel/auditAllSubclass/MappedSubclassingAllAuditedTest.java @@ -31,6 +31,7 @@ import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase; import org.hibernate.envers.test.Priority; import org.hibernate.envers.test.integration.superclass.auditAtMethodSuperclassLevel.AuditedMethodMappedSuperclass; import org.hibernate.envers.test.integration.superclass.auditAtMethodSuperclassLevel.NotAuditedSubclassEntity; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.junit.Test; @@ -38,6 +39,7 @@ import org.junit.Test; * @author Adam Warski (adam at warski dot org) * @author Hern&aacut;n Chanfreau */ +@FailureExpectedWithNewMetamodel( message = "@MappedSuperclass not supported with new metamodel by envers yet.") public class MappedSubclassingAllAuditedTest extends BaseEnversJPAFunctionalTestCase { private Integer id2_1; private Integer id1_1; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditAtMethodSuperclassLevel/auditMethodSubclass/MappedSubclassingMethodAuditedTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditAtMethodSuperclassLevel/auditMethodSubclass/MappedSubclassingMethodAuditedTest.java index 788c385ea0..cad83500f4 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditAtMethodSuperclassLevel/auditMethodSubclass/MappedSubclassingMethodAuditedTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditAtMethodSuperclassLevel/auditMethodSubclass/MappedSubclassingMethodAuditedTest.java @@ -31,6 +31,7 @@ import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase; import org.hibernate.envers.test.Priority; import org.hibernate.envers.test.integration.superclass.auditAtMethodSuperclassLevel.AuditedMethodMappedSuperclass; import org.hibernate.envers.test.integration.superclass.auditAtMethodSuperclassLevel.NotAuditedSubclassEntity; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.junit.Test; @@ -38,6 +39,7 @@ import org.junit.Test; * @author Adam Warski (adam at warski dot org) * @author Hern&aacut;n Chanfreau */ +@FailureExpectedWithNewMetamodel( message = "@MappedSuperclass not supported with new metamodel by envers yet.") public class MappedSubclassingMethodAuditedTest extends BaseEnversJPAFunctionalTestCase { private Integer id2_1; private Integer id1_1; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditedAtSuperclassLevel/auditAllSubclass/MappedSubclassingAllAuditedTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditedAtSuperclassLevel/auditAllSubclass/MappedSubclassingAllAuditedTest.java index d5c38c3572..f043d6a179 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditedAtSuperclassLevel/auditAllSubclass/MappedSubclassingAllAuditedTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditedAtSuperclassLevel/auditAllSubclass/MappedSubclassingAllAuditedTest.java @@ -31,6 +31,7 @@ import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase; import org.hibernate.envers.test.Priority; import org.hibernate.envers.test.integration.superclass.auditedAtSuperclassLevel.AuditedAllMappedSuperclass; import org.hibernate.envers.test.integration.superclass.auditedAtSuperclassLevel.NotAuditedSubclassEntity; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.junit.Test; @@ -38,6 +39,7 @@ import org.junit.Test; * @author Adam Warski (adam at warski dot org) * @author Hern&aacut;n Chanfreau */ +@FailureExpectedWithNewMetamodel( message = "@MappedSuperclass not supported with new metamodel by envers yet.") public class MappedSubclassingAllAuditedTest extends BaseEnversJPAFunctionalTestCase { private Integer id2_1; private Integer id1_1; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditedAtSuperclassLevel/auditMethodSubclass/MappedSubclassingMethodAuditedTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditedAtSuperclassLevel/auditMethodSubclass/MappedSubclassingMethodAuditedTest.java index 84e4e08f7a..168984bb11 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditedAtSuperclassLevel/auditMethodSubclass/MappedSubclassingMethodAuditedTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditedAtSuperclassLevel/auditMethodSubclass/MappedSubclassingMethodAuditedTest.java @@ -31,6 +31,7 @@ import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase; import org.hibernate.envers.test.Priority; import org.hibernate.envers.test.integration.superclass.auditedAtSuperclassLevel.AuditedAllMappedSuperclass; import org.hibernate.envers.test.integration.superclass.auditedAtSuperclassLevel.NotAuditedSubclassEntity; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.junit.Test; @@ -38,6 +39,7 @@ import org.junit.Test; * @author Adam Warski (adam at warski dot org) * @author Hern&aacut;n Chanfreau */ +@FailureExpectedWithNewMetamodel( message = "@MappedSuperclass not supported with new metamodel by envers yet.") public class MappedSubclassingMethodAuditedTest extends BaseEnversJPAFunctionalTestCase { private Integer id2_1; private Integer id1_1; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditoverride/AuditClassOverrideTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditoverride/AuditClassOverrideTest.java index 0f2ed23ae8..99667e0a2c 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditoverride/AuditClassOverrideTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditoverride/AuditClassOverrideTest.java @@ -16,6 +16,7 @@ import org.hibernate.testing.TestForIssue; * @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com) */ @TestForIssue(jiraKey = "HHH-4439") +@FailureExpectedWithNewMetamodel( message = "@MappedSuperclass not supported with new metamodel by envers yet.") public class AuditClassOverrideTest extends BaseEnversJPAFunctionalTestCase { private Integer classAuditedEntityId = null; private Integer classNotAuditedEntityId = null; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditparents/MultipleAuditParentsTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditparents/MultipleAuditParentsTest.java index 08a5400e3e..d3d5572313 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditparents/MultipleAuditParentsTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditparents/MultipleAuditParentsTest.java @@ -21,6 +21,7 @@ import org.junit.Test; * * @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com) */ +@FailureExpectedWithNewMetamodel( message = "@MappedSuperclass not supported with new metamodel by envers yet.") public class MultipleAuditParentsTest extends BaseEnversJPAFunctionalTestCase { private long childMultipleId = 1L; private Integer siteMultipleId = null; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditparents/SingleAuditParentsTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditparents/SingleAuditParentsTest.java index 8733f85cd9..4b511a4491 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditparents/SingleAuditParentsTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditparents/SingleAuditParentsTest.java @@ -21,6 +21,7 @@ import org.junit.Test; * * @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com) */ +@FailureExpectedWithNewMetamodel( message = "@MappedSuperclass not supported with new metamodel by envers yet.") public class SingleAuditParentsTest extends BaseEnversJPAFunctionalTestCase { private long childSingleId = 1L; private Integer siteSingleId = null; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditparents/TotalAuditParentsTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditparents/TotalAuditParentsTest.java index 2d61a5b7cd..27c40221c7 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditparents/TotalAuditParentsTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditparents/TotalAuditParentsTest.java @@ -21,6 +21,7 @@ import org.junit.Test; * * @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com) */ +@FailureExpectedWithNewMetamodel( message = "@MappedSuperclass not supported with new metamodel by envers yet.") public class TotalAuditParentsTest extends BaseEnversJPAFunctionalTestCase { private long babyCompleteId = 1L; private Integer siteCompleteId = null; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditparents/TransitiveAuditParentsTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditparents/TransitiveAuditParentsTest.java index ca23562b0d..b6f55864b9 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditparents/TransitiveAuditParentsTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/superclass/auditparents/TransitiveAuditParentsTest.java @@ -19,6 +19,7 @@ import org.junit.Test; * * @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com) */ +@FailureExpectedWithNewMetamodel( message = "@MappedSuperclass not supported with new metamodel by envers yet.") public class TransitiveAuditParentsTest extends BaseEnversJPAFunctionalTestCase { private long childImpTransId = 1L; private long childExpTransId = 2L; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/tools/TestTools.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/tools/TestTools.java index 3e74f10baa..61ab00572e 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/tools/TestTools.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/tools/TestTools.java @@ -28,14 +28,11 @@ import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import org.hibernate.envers.enhanced.SequenceIdRevisionEntity; -import org.hibernate.mapping.PersistentClass; -import org.hibernate.mapping.Property; import org.hibernate.metamodel.spi.binding.AttributeBinding; import org.hibernate.metamodel.spi.binding.EntityBinding;