From fb651ef07d02afcf745c808ed18ea14927ef7502 Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Fri, 20 Aug 2021 14:02:26 -0500 Subject: [PATCH] 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 --- .../orm/test/discriminator/DiscriminatorQueryUsageTests.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/discriminator/DiscriminatorQueryUsageTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/discriminator/DiscriminatorQueryUsageTests.java index e62c36beed..3c8034c620 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/discriminator/DiscriminatorQueryUsageTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/discriminator/DiscriminatorQueryUsageTests.java @@ -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 ); } );