Skip to content

Commit

Permalink
HHH-16967 Missing join on inheritance parent table to validate @where
Browse files Browse the repository at this point in the history
…condition
  • Loading branch information
dreab8 committed Dec 4, 2023
1 parent 166f6e6 commit ed743a5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6718,4 +6718,8 @@ protected String[][] getLazyPropertyColumnAliases() {
public String getDiscriminatorAlias() {
return DISCRIMINATOR_ALIAS;
}

protected String getSqlWhereStringTableExpression(){
return sqlWhereStringTableExpression;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1366,6 +1366,13 @@ public void pruneForSubclasses(TableGroup tableGroup, Map<String, EntityNameUse>
if ( mainTableReference != null ) {
retainedTableReferences.add( mainTableReference );
}
final String sqlWhereStringTableExpression = persister.getSqlWhereStringTableExpression();
if ( sqlWhereStringTableExpression != null ) {
final TableReference tableReference = tableGroup.getTableReference( sqlWhereStringTableExpression );
if ( tableReference != null ) {
retainedTableReferences.add( tableReference );
}
}
if ( needsDiscriminator() ) {
// We allow multiple joined subclasses to use the same table if they define a discriminator column.
// In this case, we might need to add a discriminator condition to make sure we filter the correct subtype,
Expand Down

0 comments on commit ed743a5

Please sign in to comment.