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 @@ -1293,15 +1293,16 @@ private boolean applyDiscriminatorPredicate(
1293
1293
Map <String , EntityNameUse > entityNameUses ,
1294
1294
MappingMetamodelImplementor metamodel ) {
1295
1295
if ( tableReference .getTableExpression ().equals ( getRootTableName () ) ) {
1296
- assert join .getJoinType () == SqlAstJoinType .INNER : "Found table reference join with root table of non-INNER type: " + join .getJoinType ();
1297
1296
final String discriminatorPredicate = getPrunedDiscriminatorPredicate (
1298
1297
entityNameUses ,
1299
1298
metamodel ,
1300
1299
"t"
1301
- // tableReference.getIdentificationVariable()
1302
1300
);
1303
- tableReference .setPrunedTableExpression ( "(select * from " + getRootTableName () + " t where " + discriminatorPredicate + ")" );
1304
- // join.applyPredicate( new SqlFragmentPredicate( discriminatorPredicate ) );
1301
+ // null means we're filtering for all subtypes, so we don't need to apply a predicate
1302
+ if ( discriminatorPredicate != null ) {
1303
+ assert join .getJoinType () == SqlAstJoinType .INNER : "Found table reference join with root table of non-INNER type: " + join .getJoinType ();
1304
+ tableReference .setPrunedTableExpression ( "(select * from " + getRootTableName () + " t where " + discriminatorPredicate + ")" );
1305
+ }
1305
1306
return true ;
1306
1307
}
1307
1308
return false ;
You can’t perform that action at this time.
0 commit comments