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:
parent
78bd816a85
commit
fb651ef07d
|
@ -50,7 +50,7 @@ public class DiscriminatorQueryUsageTests {
|
||||||
@Test
|
@Test
|
||||||
public void testUsageAsPredicateOfUnderlyingType(SessionFactoryScope scope) {
|
public void testUsageAsPredicateOfUnderlyingType(SessionFactoryScope scope) {
|
||||||
scope.inTransaction( (session) -> {
|
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 );
|
Assertions.assertThat( id ).isEqualTo( steveId );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ public class DiscriminatorQueryUsageTests {
|
||||||
public void testUsageAsPredicateWithParamOfUnderlyingType(SessionFactoryScope scope) {
|
public void testUsageAsPredicateWithParamOfUnderlyingType(SessionFactoryScope scope) {
|
||||||
scope.inTransaction( (session) -> {
|
scope.inTransaction( (session) -> {
|
||||||
final Long id = session.createQuery( "select p.id from Person p where type(p) = :type", Long.class )
|
final Long id = session.createQuery( "select p.id from Person p where type(p) = :type", Long.class )
|
||||||
.setParameter( "type", "P" )
|
.setParameter( "type", "E" )
|
||||||
.uniqueResult();
|
.uniqueResult();
|
||||||
Assertions.assertThat( id ).isEqualTo( steveId );
|
Assertions.assertThat( id ).isEqualTo( steveId );
|
||||||
} );
|
} );
|
||||||
|
|
Loading…
Reference in New Issue