HHH-7736 join subclass support
This commit is contained in:
parent
0671761c14
commit
9b7462c39c
|
@ -135,22 +135,22 @@ public class InheritanceBindingTest extends BaseAnnotationBindingTestCase {
|
||||||
noInheritanceEntityBinding.getHierarchyDetails().getEntityIdentifier().getAttributeBinding(),
|
noInheritanceEntityBinding.getHierarchyDetails().getEntityIdentifier().getAttributeBinding(),
|
||||||
directAttributeBindings.iterator().next()
|
directAttributeBindings.iterator().next()
|
||||||
);
|
);
|
||||||
assertEquals( 1, noInheritanceEntityBinding.getAttributeBindingClosureSpan() );
|
assertEquals( 0, noInheritanceEntityBinding.getAttributeBindingClosureSpan() );
|
||||||
Iterator<AttributeBinding> iterator = noInheritanceEntityBinding.attributeBindings().iterator();
|
Iterator<AttributeBinding> iterator = noInheritanceEntityBinding.attributeBindings().iterator();
|
||||||
assertTrue( iterator.hasNext() );
|
assertTrue( iterator.hasNext() );
|
||||||
assertSame( noInheritanceEntityBinding.getHierarchyDetails().getEntityIdentifier().getAttributeBinding(), iterator.next() );
|
assertSame( noInheritanceEntityBinding.getHierarchyDetails().getEntityIdentifier().getAttributeBinding(), iterator.next() );
|
||||||
assertFalse( iterator.hasNext() );
|
assertFalse( iterator.hasNext() );
|
||||||
|
|
||||||
AttributeBinding[] attributeBindings = noInheritanceEntityBinding.getAttributeBindingClosure();
|
AttributeBinding[] attributeBindings = noInheritanceEntityBinding.getAttributeBindingClosure();
|
||||||
assertTrue( attributeBindings.length > 0 );
|
assertTrue( attributeBindings.length == 0 );
|
||||||
int index =0;
|
// int index =0;
|
||||||
assertSame( noInheritanceEntityBinding.getHierarchyDetails().getEntityIdentifier().getAttributeBinding(), attributeBindings[index++] );
|
// assertSame( noInheritanceEntityBinding.getHierarchyDetails().getEntityIdentifier().getAttributeBinding(), attributeBindings[index++] );
|
||||||
assertFalse( index < attributeBindings.length );
|
// assertFalse( index < attributeBindings.length );
|
||||||
attributeBindings = noInheritanceEntityBinding.getEntitiesAttributeBindingClosure();
|
attributeBindings = noInheritanceEntityBinding.getEntitiesAttributeBindingClosure();
|
||||||
index = 0;
|
// int index = 0;
|
||||||
assertTrue( attributeBindings.length > 0 );
|
assertFalse( attributeBindings.length > 0 );
|
||||||
assertSame( noInheritanceEntityBinding.getHierarchyDetails().getEntityIdentifier().getAttributeBinding(), attributeBindings[index++] );
|
// assertSame( noInheritanceEntityBinding.getHierarchyDetails().getEntityIdentifier().getAttributeBinding(), attributeBindings[index++] );
|
||||||
assertFalse( index < attributeBindings.length );
|
// assertFalse( index < attributeBindings.length );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -193,19 +193,19 @@ public class InheritanceBindingTest extends BaseAnnotationBindingTestCase {
|
||||||
}
|
}
|
||||||
assertEquals( 1, directAttributeBindings.size() );
|
assertEquals( 1, directAttributeBindings.size() );
|
||||||
assertTrue( directAttributeBindings.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) );
|
assertTrue( directAttributeBindings.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) );
|
||||||
assertEquals( 1, rootEntityBinding.getAttributeBindingClosureSpan() );
|
assertEquals( 0, rootEntityBinding.getAttributeBindingClosureSpan() );
|
||||||
Set<AttributeBinding> attributeBindingClosure = new HashSet<AttributeBinding>();
|
Set<AttributeBinding> attributeBindingClosure = new HashSet<AttributeBinding>();
|
||||||
for ( AttributeBinding attributeBinding : rootEntityBinding.getAttributeBindingClosure() ) {
|
for ( AttributeBinding attributeBinding : rootEntityBinding.getAttributeBindingClosure() ) {
|
||||||
assertTrue( attributeBindingClosure.add( attributeBinding ) );
|
assertTrue( attributeBindingClosure.add( attributeBinding ) );
|
||||||
}
|
}
|
||||||
assertEquals( 1, attributeBindingClosure.size() );
|
assertEquals( 0, attributeBindingClosure.size() );
|
||||||
assertTrue( attributeBindingClosure.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) );
|
assertFalse( attributeBindingClosure.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) );
|
||||||
Set<AttributeBinding> subAttributeBindings = new HashSet<AttributeBinding>();
|
Set<AttributeBinding> subAttributeBindings = new HashSet<AttributeBinding>();
|
||||||
for ( AttributeBinding subAttributeBinding : rootEntityBinding.getEntitiesAttributeBindingClosure() ) {
|
for ( AttributeBinding subAttributeBinding : rootEntityBinding.getEntitiesAttributeBindingClosure() ) {
|
||||||
assertTrue( subAttributeBindings.add( subAttributeBinding ) );
|
assertTrue( subAttributeBindings.add( subAttributeBinding ) );
|
||||||
}
|
}
|
||||||
assertEquals( 4, subAttributeBindings.size() );
|
assertEquals( 3, subAttributeBindings.size() );
|
||||||
assertTrue( subAttributeBindings.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) );
|
assertFalse( subAttributeBindings.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) );
|
||||||
assertTrue( subAttributeBindings.contains( subclassEntityBinding.locateAttributeBinding( "name" ) ) );
|
assertTrue( subAttributeBindings.contains( subclassEntityBinding.locateAttributeBinding( "name" ) ) );
|
||||||
assertTrue( subAttributeBindings.contains( subclassOfSubclassEntityBinding.locateAttributeBinding( "otherOtherName" ) ) );
|
assertTrue( subAttributeBindings.contains( subclassOfSubclassEntityBinding.locateAttributeBinding( "otherOtherName" ) ) );
|
||||||
assertTrue( subAttributeBindings.contains( otherSubclassEntityBinding.locateAttributeBinding( "otherName" ) ) );
|
assertTrue( subAttributeBindings.contains( otherSubclassEntityBinding.locateAttributeBinding( "otherName" ) ) );
|
||||||
|
@ -310,20 +310,20 @@ public class InheritanceBindingTest extends BaseAnnotationBindingTestCase {
|
||||||
}
|
}
|
||||||
assertEquals( 1, directAttributeBindings.size() );
|
assertEquals( 1, directAttributeBindings.size() );
|
||||||
assertTrue( directAttributeBindings.contains( otherSubclassEntityBinding.locateAttributeBinding( "otherName" ) ) );
|
assertTrue( directAttributeBindings.contains( otherSubclassEntityBinding.locateAttributeBinding( "otherName" ) ) );
|
||||||
assertEquals( 2, otherSubclassEntityBinding.getAttributeBindingClosureSpan() );
|
assertEquals( 1, otherSubclassEntityBinding.getAttributeBindingClosureSpan() );
|
||||||
Set<AttributeBinding> attributeBindingClosure = new HashSet<AttributeBinding>();
|
Set<AttributeBinding> attributeBindingClosure = new HashSet<AttributeBinding>();
|
||||||
for ( AttributeBinding attributeBinding : otherSubclassEntityBinding.getAttributeBindingClosure() ) {
|
for ( AttributeBinding attributeBinding : otherSubclassEntityBinding.getAttributeBindingClosure() ) {
|
||||||
assertTrue( attributeBindingClosure.add( attributeBinding ) );
|
assertTrue( attributeBindingClosure.add( attributeBinding ) );
|
||||||
}
|
}
|
||||||
assertEquals(2, attributeBindingClosure.size() );
|
assertEquals(1, attributeBindingClosure.size() );
|
||||||
assertTrue( attributeBindingClosure.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) );
|
assertFalse( attributeBindingClosure.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) );
|
||||||
assertTrue( attributeBindingClosure.contains( otherSubclassEntityBinding.locateAttributeBinding( "otherName" ) ) );
|
assertTrue( attributeBindingClosure.contains( otherSubclassEntityBinding.locateAttributeBinding( "otherName" ) ) );
|
||||||
Set<AttributeBinding> subAttributeBindings = new HashSet<AttributeBinding>();
|
Set<AttributeBinding> subAttributeBindings = new HashSet<AttributeBinding>();
|
||||||
for ( AttributeBinding subAttributeBinding : otherSubclassEntityBinding.getEntitiesAttributeBindingClosure() ) {
|
for ( AttributeBinding subAttributeBinding : otherSubclassEntityBinding.getEntitiesAttributeBindingClosure() ) {
|
||||||
assertTrue( subAttributeBindings.add( subAttributeBinding ) );
|
assertTrue( subAttributeBindings.add( subAttributeBinding ) );
|
||||||
}
|
}
|
||||||
assertEquals( 2, subAttributeBindings.size() );
|
assertEquals( 1, subAttributeBindings.size() );
|
||||||
assertTrue( subAttributeBindings.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) );
|
assertFalse( subAttributeBindings.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) );
|
||||||
assertTrue( subAttributeBindings.contains( otherSubclassEntityBinding.locateAttributeBinding( "otherName" ) ) );
|
assertTrue( subAttributeBindings.contains( otherSubclassEntityBinding.locateAttributeBinding( "otherName" ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,20 +364,20 @@ public class InheritanceBindingTest extends BaseAnnotationBindingTestCase {
|
||||||
}
|
}
|
||||||
assertEquals( 1, directAttributeBindings.size() );
|
assertEquals( 1, directAttributeBindings.size() );
|
||||||
assertTrue( directAttributeBindings.contains( subclassEntityBinding.locateAttributeBinding( "name" ) ) );
|
assertTrue( directAttributeBindings.contains( subclassEntityBinding.locateAttributeBinding( "name" ) ) );
|
||||||
assertEquals( 2, subclassEntityBinding.getAttributeBindingClosureSpan() );
|
assertEquals( 1, subclassEntityBinding.getAttributeBindingClosureSpan() );
|
||||||
Set<AttributeBinding> attributeBindingClosure = new HashSet<AttributeBinding>();
|
Set<AttributeBinding> attributeBindingClosure = new HashSet<AttributeBinding>();
|
||||||
for ( AttributeBinding attributeBinding : subclassEntityBinding.getAttributeBindingClosure() ) {
|
for ( AttributeBinding attributeBinding : subclassEntityBinding.getAttributeBindingClosure() ) {
|
||||||
assertTrue( attributeBindingClosure.add( attributeBinding ) );
|
assertTrue( attributeBindingClosure.add( attributeBinding ) );
|
||||||
}
|
}
|
||||||
assertEquals( 2, attributeBindingClosure.size() );
|
assertEquals( 1, attributeBindingClosure.size() );
|
||||||
assertTrue( attributeBindingClosure.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) );
|
assertFalse( attributeBindingClosure.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) );
|
||||||
assertTrue( attributeBindingClosure.contains( subclassEntityBinding.locateAttributeBinding( "name" ) ) );
|
assertTrue( attributeBindingClosure.contains( subclassEntityBinding.locateAttributeBinding( "name" ) ) );
|
||||||
Set<AttributeBinding> subAttributeBindings = new HashSet<AttributeBinding>();
|
Set<AttributeBinding> subAttributeBindings = new HashSet<AttributeBinding>();
|
||||||
for ( AttributeBinding subAttributeBinding : subclassEntityBinding.getEntitiesAttributeBindingClosure() ) {
|
for ( AttributeBinding subAttributeBinding : subclassEntityBinding.getEntitiesAttributeBindingClosure() ) {
|
||||||
assertTrue( subAttributeBindings.add( subAttributeBinding ) );
|
assertTrue( subAttributeBindings.add( subAttributeBinding ) );
|
||||||
}
|
}
|
||||||
assertEquals( 3, subAttributeBindings.size() );
|
assertEquals( 2, subAttributeBindings.size() );
|
||||||
assertTrue( subAttributeBindings.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) );
|
assertFalse( subAttributeBindings.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) );
|
||||||
assertTrue( subAttributeBindings.contains( subclassEntityBinding.locateAttributeBinding( "name" ) ) );
|
assertTrue( subAttributeBindings.contains( subclassEntityBinding.locateAttributeBinding( "name" ) ) );
|
||||||
assertTrue( subAttributeBindings.contains( subclassOfSubclassEntityBinding.locateAttributeBinding( "otherOtherName" ) ) );
|
assertTrue( subAttributeBindings.contains( subclassOfSubclassEntityBinding.locateAttributeBinding( "otherOtherName" ) ) );
|
||||||
}
|
}
|
||||||
|
@ -411,21 +411,21 @@ public class InheritanceBindingTest extends BaseAnnotationBindingTestCase {
|
||||||
}
|
}
|
||||||
assertEquals( 1, directAttributeBindings.size() );
|
assertEquals( 1, directAttributeBindings.size() );
|
||||||
assertTrue( directAttributeBindings.contains( subclassOfSubclassEntityBinding.locateAttributeBinding( "otherOtherName" ) ) );
|
assertTrue( directAttributeBindings.contains( subclassOfSubclassEntityBinding.locateAttributeBinding( "otherOtherName" ) ) );
|
||||||
assertEquals( 3, subclassOfSubclassEntityBinding.getAttributeBindingClosureSpan() );
|
assertEquals( 2, subclassOfSubclassEntityBinding.getAttributeBindingClosureSpan() );
|
||||||
Set<AttributeBinding> attributeBindingClosure = new HashSet<AttributeBinding>();
|
Set<AttributeBinding> attributeBindingClosure = new HashSet<AttributeBinding>();
|
||||||
for ( AttributeBinding attributeBinding : subclassOfSubclassEntityBinding.getAttributeBindingClosure() ) {
|
for ( AttributeBinding attributeBinding : subclassOfSubclassEntityBinding.getAttributeBindingClosure() ) {
|
||||||
assertTrue( attributeBindingClosure.add( attributeBinding ) );
|
assertTrue( attributeBindingClosure.add( attributeBinding ) );
|
||||||
}
|
}
|
||||||
assertEquals( 3, attributeBindingClosure.size() );
|
assertEquals( 2, attributeBindingClosure.size() );
|
||||||
assertTrue( attributeBindingClosure.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) );
|
assertFalse( attributeBindingClosure.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) );
|
||||||
assertTrue( attributeBindingClosure.contains( subclassEntityBinding.locateAttributeBinding( "name" ) ) );
|
assertTrue( attributeBindingClosure.contains( subclassEntityBinding.locateAttributeBinding( "name" ) ) );
|
||||||
assertTrue( attributeBindingClosure.contains( subclassOfSubclassEntityBinding.locateAttributeBinding( "otherOtherName" ) ) );
|
assertTrue( attributeBindingClosure.contains( subclassOfSubclassEntityBinding.locateAttributeBinding( "otherOtherName" ) ) );
|
||||||
Set<AttributeBinding> subAttributeBindings = new HashSet<AttributeBinding>();
|
Set<AttributeBinding> subAttributeBindings = new HashSet<AttributeBinding>();
|
||||||
for ( AttributeBinding subAttributeBinding : subclassOfSubclassEntityBinding.getEntitiesAttributeBindingClosure() ) {
|
for ( AttributeBinding subAttributeBinding : subclassOfSubclassEntityBinding.getEntitiesAttributeBindingClosure() ) {
|
||||||
assertTrue( subAttributeBindings.add( subAttributeBinding ) );
|
assertTrue( subAttributeBindings.add( subAttributeBinding ) );
|
||||||
}
|
}
|
||||||
assertEquals( 3, subAttributeBindings.size() );
|
assertEquals( 2, subAttributeBindings.size() );
|
||||||
assertTrue( subAttributeBindings.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) );
|
assertFalse( subAttributeBindings.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) );
|
||||||
assertTrue( subAttributeBindings.contains( subclassEntityBinding.locateAttributeBinding( "name" ) ) );
|
assertTrue( subAttributeBindings.contains( subclassEntityBinding.locateAttributeBinding( "name" ) ) );
|
||||||
assertTrue( subAttributeBindings.contains( subclassOfSubclassEntityBinding.locateAttributeBinding( "otherOtherName" ) ) );
|
assertTrue( subAttributeBindings.contains( subclassOfSubclassEntityBinding.locateAttributeBinding( "otherOtherName" ) ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ import org.hibernate.Session;
|
||||||
import org.hibernate.Transaction;
|
import org.hibernate.Transaction;
|
||||||
import org.hibernate.criterion.Property;
|
import org.hibernate.criterion.Property;
|
||||||
import org.hibernate.criterion.Restrictions;
|
import org.hibernate.criterion.Restrictions;
|
||||||
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
|
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
@ -47,7 +46,6 @@ import static org.junit.Assert.assertTrue;
|
||||||
/**
|
/**
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
*/
|
*/
|
||||||
@FailureExpectedWithNewMetamodel
|
|
||||||
public class JoinedSubclassTest extends BaseCoreFunctionalTestCase {
|
public class JoinedSubclassTest extends BaseCoreFunctionalTestCase {
|
||||||
@Override
|
@Override
|
||||||
public String[] getMappings() {
|
public String[] getMappings() {
|
||||||
|
|
Loading…
Reference in New Issue