File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
hibernate-core/src/main/java/org/hibernate/persister/entity Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -1437,15 +1437,16 @@ private boolean applyDiscriminatorPredicate(
1437
1437
Map <String , EntityNameUse > entityNameUses ,
1438
1438
MappingMetamodelImplementor metamodel ) {
1439
1439
if ( tableReference .getTableExpression ().equals ( getRootTableName () ) ) {
1440
- assert join .getJoinType () == SqlAstJoinType .INNER : "Found table reference join with root table of non-INNER type: " + join .getJoinType ();
1441
1440
final String discriminatorPredicate = getPrunedDiscriminatorPredicate (
1442
1441
entityNameUses ,
1443
1442
metamodel ,
1444
1443
"t"
1445
- // tableReference.getIdentificationVariable()
1446
1444
);
1447
- tableReference .setPrunedTableExpression ( "(select * from " + getRootTableName () + " t where " + discriminatorPredicate + ")" );
1448
- // join.applyPredicate( new SqlFragmentPredicate( discriminatorPredicate ) );
1445
+ // null means we're filtering for all subtypes, so we don't need to apply a predicate
1446
+ if ( discriminatorPredicate != null ) {
1447
+ assert join .getJoinType () == SqlAstJoinType .INNER : "Found table reference join with root table of non-INNER type: " + join .getJoinType ();
1448
+ tableReference .setPrunedTableExpression ( "(select * from " + getRootTableName () + " t where " + discriminatorPredicate + ")" );
1449
+ }
1449
1450
return true ;
1450
1451
}
1451
1452
return false ;
You can’t perform that action at this time.
0 commit comments