discriminator work

- Handle discriminator as Fetch for entity ResultGraphNodes.  This allows us to make the distinction about whether to handle the discriminator as `Class` or as its "underlying" type when selecting it.  Fetches return the underlying type.  DomainResults return `Class`, or String for entity-named entity mappings
This commit is contained in:
Steve Ebersole 2021-08-20 14:02:26 -05:00
parent 78bd816a85
commit fb651ef07d
1 changed files with 2 additions and 2 deletions

View File

@ -50,7 +50,7 @@ public class DiscriminatorQueryUsageTests {
@Test
public void testUsageAsPredicateOfUnderlyingType(SessionFactoryScope scope) {
scope.inTransaction( (session) -> {
final Long id = session.createQuery( "select p.id from Person p where type(p) = 'P'", Long.class ).uniqueResult();
final Long id = session.createQuery( "select p.id from Person p where type(p) = 'E'", Long.class ).uniqueResult();
Assertions.assertThat( id ).isEqualTo( steveId );
} );
}
@ -69,7 +69,7 @@ public class DiscriminatorQueryUsageTests {
public void testUsageAsPredicateWithParamOfUnderlyingType(SessionFactoryScope scope) {
scope.inTransaction( (session) -> {
final Long id = session.createQuery( "select p.id from Person p where type(p) = :type", Long.class )
.setParameter( "type", "P" )
.setParameter( "type", "E" )
.uniqueResult();
Assertions.assertThat( id ).isEqualTo( steveId );
} );