Skip to content

Commit f62cecc

Browse files
beikovsebersole
authored andcommitted
HHH-12565 Fix that returns the discriminator constant instead of column reference for leaf subtypes
1 parent f972dd4 commit f62cecc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,11 @@ public String getDiscriminatorColumnReaders() {
338338
}
339339

340340
public String getDiscriminatorColumnReaderTemplate() {
341-
return Template.TEMPLATE + "." + DISCRIMINATOR_ALIAS;
341+
if ( getEntityMetamodel().getSubclassEntityNames().size() == 1 ) {
342+
return getDiscriminatorSQLValue();
343+
} else {
344+
return Template.TEMPLATE + "." + DISCRIMINATOR_ALIAS;
345+
}
342346
}
343347

344348
protected String getDiscriminatorAlias() {

0 commit comments

Comments
 (0)