HHH-8184 association attributes from mapped super class are not included
This commit is contained in:
parent
f29a670378
commit
a448e268e0
|
@ -38,7 +38,9 @@ import org.hibernate.AnnotationException;
|
|||
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 class RootEntityClass extends EntityClass {
|
|||
return attributes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AssociationAttribute> getAssociationAttributes() {
|
||||
List<Iterable<AssociationAttribute>> list = new ArrayList<Iterable<AssociationAttribute>>( );
|
||||
list.add( super.getAssociationAttributes() );
|
||||
|
||||
// now the attributes of the mapped superclasses
|
||||
for ( MappedSuperclass mappedSuperclass : mappedSuperclasses ) {
|
||||
list.add( mappedSuperclass.getAssociationAttributes() );
|
||||
}
|
||||
|
||||
return new JoinedIterable<AssociationAttribute>( list );
|
||||
}
|
||||
|
||||
public Collection<MappedAttribute> getIdAttributes() {
|
||||
List<MappedAttribute> attributes = new ArrayList<MappedAttribute>();
|
||||
|
||||
|
|
|
@ -29,13 +29,11 @@ import org.hibernate.Session;
|
|||
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 {
|
||||
|
|
|
@ -12,7 +12,8 @@ import org.junit.Test;
|
|||
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 @@ import static org.junit.Assert.fail;
|
|||
/**
|
||||
* @author Manuel Bernhardt <bernhardt.manuel@gmail.com>
|
||||
*/
|
||||
@FailureExpectedWithNewMetamodel
|
||||
public class UniqueConstraintTest extends BaseCoreFunctionalTestCase {
|
||||
|
||||
@Override
|
||||
|
@ -70,25 +70,26 @@ public class UniqueConstraintTest extends BaseCoreFunctionalTestCase {
|
|||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-8026" )
|
||||
public void testUnNamedConstraints() {
|
||||
Iterator<org.hibernate.mapping.Table> 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" ) ) {
|
||||
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.getName().equals( "UniqueNoNameB" ) ) {
|
||||
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
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.hibernate.jpa.test.metamodel.Product_;
|
|||
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;
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ import static org.junit.Assert.assertEquals;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@FailureExpectedWithNewMetamodel
|
||||
@FailureExpectedWithNewMetamodel(message = "@OneToOne with mappedBy specified is not supported yet")
|
||||
public class ExpressionsTest extends AbstractMetamodelSpecificTest {
|
||||
private CriteriaBuilder builder;
|
||||
|
||||
|
|
|
@ -28,8 +28,6 @@ import javax.persistence.EntityManager;
|
|||
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 @@ import static org.junit.Assert.assertTrue;
|
|||
*/
|
||||
public class IsLoadedTest extends BaseEntityManagerFunctionalTestCase {
|
||||
@Test
|
||||
@FailureExpectedWithNewMetamodel
|
||||
public void testIsLoadedOnPrivateSuperclassProperty() {
|
||||
EntityManager em = entityManagerFactory().createEntityManager();
|
||||
em.getTransaction().begin();
|
||||
|
|
Loading…
Reference in New Issue