mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-16 16:15:06 +00:00
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.MappingException;
|
import org.hibernate.MappingException;
|
||||||
import org.hibernate.internal.CoreMessageLogger;
|
import org.hibernate.internal.CoreMessageLogger;
|
||||||
import org.hibernate.internal.util.collections.CollectionHelper;
|
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.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.BasicAttribute;
|
||||||
import org.hibernate.metamodel.internal.source.annotations.attribute.Column;
|
import org.hibernate.metamodel.internal.source.annotations.attribute.Column;
|
||||||
import org.hibernate.metamodel.internal.source.annotations.attribute.FormulaValue;
|
import org.hibernate.metamodel.internal.source.annotations.attribute.FormulaValue;
|
||||||
@ -168,6 +170,19 @@ public Collection<BasicAttribute> getSimpleAttributes() {
|
|||||||
return attributes;
|
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() {
|
public Collection<MappedAttribute> getIdAttributes() {
|
||||||
List<MappedAttribute> attributes = new ArrayList<MappedAttribute>();
|
List<MappedAttribute> attributes = new ArrayList<MappedAttribute>();
|
||||||
|
|
||||||
|
@ -29,13 +29,11 @@
|
|||||||
import org.hibernate.Transaction;
|
import org.hibernate.Transaction;
|
||||||
import org.hibernate.cfg.Configuration;
|
import org.hibernate.cfg.Configuration;
|
||||||
import org.hibernate.cfg.Environment;
|
import org.hibernate.cfg.Environment;
|
||||||
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
|
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Emmanuel Bernard
|
* @author Emmanuel Bernard
|
||||||
*/
|
*/
|
||||||
@FailureExpectedWithNewMetamodel
|
|
||||||
public class GenericsTest extends BaseCoreFunctionalTestCase {
|
public class GenericsTest extends BaseCoreFunctionalTestCase {
|
||||||
@Test
|
@Test
|
||||||
public void testManyToOneGenerics() throws Exception {
|
public void testManyToOneGenerics() throws Exception {
|
||||||
|
@ -12,7 +12,8 @@
|
|||||||
import org.hibernate.JDBCException;
|
import org.hibernate.JDBCException;
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.Transaction;
|
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.TestForIssue;
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
|
|
||||||
@ -22,7 +23,6 @@
|
|||||||
/**
|
/**
|
||||||
* @author Manuel Bernhardt <bernhardt.manuel@gmail.com>
|
* @author Manuel Bernhardt <bernhardt.manuel@gmail.com>
|
||||||
*/
|
*/
|
||||||
@FailureExpectedWithNewMetamodel
|
|
||||||
public class UniqueConstraintTest extends BaseCoreFunctionalTestCase {
|
public class UniqueConstraintTest extends BaseCoreFunctionalTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -70,25 +70,26 @@ public void testUniquenessConstraintWithSuperclassProperty() throws Exception {
|
|||||||
@Test
|
@Test
|
||||||
@TestForIssue( jiraKey = "HHH-8026" )
|
@TestForIssue( jiraKey = "HHH-8026" )
|
||||||
public void testUnNamedConstraints() {
|
public void testUnNamedConstraints() {
|
||||||
Iterator<org.hibernate.mapping.Table> iterator = configuration().getTableMappings();
|
Database database = metadata().getDatabase();
|
||||||
org.hibernate.mapping.Table tableA = null;
|
org.hibernate.metamodel.spi.relational.Table tableA = null;
|
||||||
org.hibernate.mapping.Table tableB = null;
|
org.hibernate.metamodel.spi.relational.Table tableB = null;
|
||||||
while( iterator.hasNext() ) {
|
for(final Schema schema : database.getSchemas()){
|
||||||
org.hibernate.mapping.Table table = iterator.next();
|
for(final org.hibernate.metamodel.spi.relational.Table table : schema.getTables()){
|
||||||
if ( table.getName().equals( "UniqueNoNameA" ) ) {
|
if ( table.getPhysicalName().getText().equals( "UniqueNoNameA" ) ) {
|
||||||
tableA = table;
|
tableA = table;
|
||||||
}
|
}
|
||||||
else if ( table.getName().equals( "UniqueNoNameB" ) ) {
|
else if ( table.getPhysicalName().getText().equals( "UniqueNoNameB" ) ) {
|
||||||
tableB = table;
|
tableB = table;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( tableA == null || tableB == null ) {
|
if ( tableA == null || tableB == null ) {
|
||||||
fail( "Could not find the expected tables." );
|
fail( "Could not find the expected tables." );
|
||||||
}
|
}
|
||||||
|
|
||||||
assertFalse( tableA.getUniqueKeyIterator().next().getName().equals(
|
assertFalse( tableA.getUniqueKeys().iterator().next().getName().equals(
|
||||||
tableB.getUniqueKeyIterator().next().getName() ) );
|
tableB.getUniqueKeys().iterator().next().getName() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
|
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
|
|
||||||
@FailureExpectedWithNewMetamodel
|
@FailureExpectedWithNewMetamodel(message = "@OneToOne with mappedBy specified is not supported yet")
|
||||||
public class CastTest extends AbstractMetamodelSpecificTest {
|
public class CastTest extends AbstractMetamodelSpecificTest {
|
||||||
private static final int QUANTITY = 2;
|
private static final int QUANTITY = 2;
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
@FailureExpectedWithNewMetamodel
|
@FailureExpectedWithNewMetamodel(message = "@OneToOne with mappedBy specified is not supported yet")
|
||||||
public class ExpressionsTest extends AbstractMetamodelSpecificTest {
|
public class ExpressionsTest extends AbstractMetamodelSpecificTest {
|
||||||
private CriteriaBuilder builder;
|
private CriteriaBuilder builder;
|
||||||
|
|
||||||
|
@ -28,8 +28,6 @@
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
||||||
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
@ -38,7 +36,6 @@
|
|||||||
*/
|
*/
|
||||||
public class IsLoadedTest extends BaseEntityManagerFunctionalTestCase {
|
public class IsLoadedTest extends BaseEntityManagerFunctionalTestCase {
|
||||||
@Test
|
@Test
|
||||||
@FailureExpectedWithNewMetamodel
|
|
||||||
public void testIsLoadedOnPrivateSuperclassProperty() {
|
public void testIsLoadedOnPrivateSuperclassProperty() {
|
||||||
EntityManager em = entityManagerFactory().createEntityManager();
|
EntityManager em = entityManagerFactory().createEntityManager();
|
||||||
em.getTransaction().begin();
|
em.getTransaction().begin();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user