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(
12931293 Map <String , EntityNameUse > entityNameUses ,
12941294 MappingMetamodelImplementor metamodel ) {
12951295 if ( tableReference .getTableExpression ().equals ( getRootTableName () ) ) {
1296- assert join .getJoinType () == SqlAstJoinType .INNER : "Found table reference join with root table of non-INNER type: " + join .getJoinType ();
12971296 final String discriminatorPredicate = getPrunedDiscriminatorPredicate (
12981297 entityNameUses ,
12991298 metamodel ,
13001299 "t"
1301- // tableReference.getIdentificationVariable()
13021300 );
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+ }
13051306 return true ;
13061307 }
13071308 return false ;
You can’t perform that action at this time.
0 commit comments