diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/entity/RootEntityClass.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/entity/RootEntityClass.java index 64e4424192..d1b3886f13 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/entity/RootEntityClass.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/entity/RootEntityClass.java @@ -38,7 +38,9 @@ import org.hibernate.MappingException; import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.util.collections.CollectionHelper; +import org.hibernate.internal.util.collections.JoinedIterable; import org.hibernate.metamodel.internal.source.annotations.AnnotationBindingContext; +import org.hibernate.metamodel.internal.source.annotations.attribute.AssociationAttribute; import org.hibernate.metamodel.internal.source.annotations.attribute.BasicAttribute; import org.hibernate.metamodel.internal.source.annotations.attribute.Column; import org.hibernate.metamodel.internal.source.annotations.attribute.FormulaValue; @@ -168,6 +170,19 @@ public Collection getSimpleAttributes() { return attributes; } + @Override + public Iterable getAssociationAttributes() { + List> list = new ArrayList>( ); + list.add( super.getAssociationAttributes() ); + + // now the attributes of the mapped superclasses + for ( MappedSuperclass mappedSuperclass : mappedSuperclasses ) { + list.add( mappedSuperclass.getAssociationAttributes() ); + } + + return new JoinedIterable( list ); + } + public Collection getIdAttributes() { List attributes = new ArrayList(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/generics/GenericsTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/generics/GenericsTest.java index fadfb3dbdf..de894f6e58 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/generics/GenericsTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/generics/GenericsTest.java @@ -29,13 +29,11 @@ import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; -import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; /** * @author Emmanuel Bernard */ -@FailureExpectedWithNewMetamodel public class GenericsTest extends BaseCoreFunctionalTestCase { @Test public void testManyToOneGenerics() throws Exception { diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/UniqueConstraintTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/UniqueConstraintTest.java index 0c8aae0106..e4ca4942d0 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/UniqueConstraintTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/UniqueConstraintTest.java @@ -12,7 +12,8 @@ import org.hibernate.JDBCException; import org.hibernate.Session; import org.hibernate.Transaction; -import org.hibernate.testing.FailureExpectedWithNewMetamodel; +import org.hibernate.metamodel.spi.relational.Database; +import org.hibernate.metamodel.spi.relational.Schema; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; @@ -22,7 +23,6 @@ /** * @author Manuel Bernhardt */ -@FailureExpectedWithNewMetamodel public class UniqueConstraintTest extends BaseCoreFunctionalTestCase { @Override @@ -70,25 +70,26 @@ public void testUniquenessConstraintWithSuperclassProperty() throws Exception { @Test @TestForIssue( jiraKey = "HHH-8026" ) public void testUnNamedConstraints() { - Iterator iterator = configuration().getTableMappings(); - org.hibernate.mapping.Table tableA = null; - org.hibernate.mapping.Table tableB = null; - while( iterator.hasNext() ) { - org.hibernate.mapping.Table table = iterator.next(); - if ( table.getName().equals( "UniqueNoNameA" ) ) { - tableA = table; - } - else if ( table.getName().equals( "UniqueNoNameB" ) ) { - tableB = table; + Database database = metadata().getDatabase(); + org.hibernate.metamodel.spi.relational.Table tableA = null; + org.hibernate.metamodel.spi.relational.Table tableB = null; + for(final Schema schema : database.getSchemas()){ + for(final org.hibernate.metamodel.spi.relational.Table table : schema.getTables()){ + if ( table.getPhysicalName().getText().equals( "UniqueNoNameA" ) ) { + tableA = table; + } + else if ( table.getPhysicalName().getText().equals( "UniqueNoNameB" ) ) { + tableB = table; + } + } } - if ( tableA == null || tableB == null ) { fail( "Could not find the expected tables." ); } - - assertFalse( tableA.getUniqueKeyIterator().next().getName().equals( - tableB.getUniqueKeyIterator().next().getName() ) ); + + assertFalse( tableA.getUniqueKeys().iterator().next().getName().equals( + tableB.getUniqueKeys().iterator().next().getName() ) ); } @Entity diff --git a/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/criteria/basic/CastTest.java b/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/criteria/basic/CastTest.java index 07819acc1a..a5950132dc 100644 --- a/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/criteria/basic/CastTest.java +++ b/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/criteria/basic/CastTest.java @@ -41,7 +41,7 @@ import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.TestForIssue; -@FailureExpectedWithNewMetamodel +@FailureExpectedWithNewMetamodel(message = "@OneToOne with mappedBy specified is not supported yet") public class CastTest extends AbstractMetamodelSpecificTest { private static final int QUANTITY = 2; diff --git a/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/criteria/basic/ExpressionsTest.java b/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/criteria/basic/ExpressionsTest.java index bd155d336f..1728733a6d 100644 --- a/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/criteria/basic/ExpressionsTest.java +++ b/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/criteria/basic/ExpressionsTest.java @@ -57,7 +57,7 @@ * * @author Steve Ebersole */ -@FailureExpectedWithNewMetamodel +@FailureExpectedWithNewMetamodel(message = "@OneToOne with mappedBy specified is not supported yet") public class ExpressionsTest extends AbstractMetamodelSpecificTest { private CriteriaBuilder builder; diff --git a/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/util/IsLoadedTest.java b/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/util/IsLoadedTest.java index 1b94cabcaf..89a389b82f 100644 --- a/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/util/IsLoadedTest.java +++ b/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/util/IsLoadedTest.java @@ -28,8 +28,6 @@ import org.junit.Test; import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; -import org.hibernate.testing.FailureExpectedWithNewMetamodel; - import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -38,7 +36,6 @@ */ public class IsLoadedTest extends BaseEntityManagerFunctionalTestCase { @Test - @FailureExpectedWithNewMetamodel public void testIsLoadedOnPrivateSuperclassProperty() { EntityManager em = entityManagerFactory().createEntityManager(); em.getTransaction().begin();