HHH-11383 - Added additional property projection test case.

This commit is contained in:
Chris Cranford 2017-01-18 10:50:38 -05:00
parent 5ac46eb703
commit 89583fd008
1 changed files with 15 additions and 0 deletions

View File

@ -110,6 +110,21 @@ public class InheritanceAssociationToOneInnerJoinTest extends BaseEnversJPAFunct
assertEquals( 2, results.size() ); assertEquals( 2, results.size() );
} }
@Test
public void testAuditQueryWithJoinedInheritanceSubclassPropertyProjectionWithRelationTraversal() {
// HHH-11383
// This test was requested by the reporter so that we have a test that shows Hibernate is
// automatically adding "INNER JOIN EntityA_AUD" despite the fact whether the query uses
// the traverseRelation API or not. This test makes sure that if the SQL generation is
// changed in the future, Envers would properly fail if so.
List results = getAuditReader().createQuery().forEntitiesAtRevision( EntityB.class, 1 )
.addProjection( property( "name" ) )
.traverseRelation( "relationToC", JoinType.INNER )
.add( property( "foo" ).like( "bar" ) )
.getResultList();
assertEquals( 2, results.size() );
}
@Entity(name = "EntityA") @Entity(name = "EntityA")
@Audited @Audited
@Inheritance(strategy = InheritanceType.JOINED) @Inheritance(strategy = InheritanceType.JOINED)