From 4eef64f81efe262733cdf5f48702165636d2f86f Mon Sep 17 00:00:00 2001 From: Jan Schatteman Date: Thu, 6 Apr 2023 00:47:43 +0200 Subject: [PATCH] HHH-16435 - Fix for issue (combine filterpredicates with potential already existing ones) Signed-off-by: Jan Schatteman --- .../org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java | 4 ++-- .../singletable/SingleTableInheritanceFilterTest.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java index 67adcaeb58..aac15f504a 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java @@ -821,7 +821,7 @@ public abstract class BaseSqmToSqlAstConverter extends Base addVersionedAssignment( assignments::add, sqmStatement ); FilterHelper.applyBaseRestrictions( - (filterPredicate) -> additionalRestrictions = filterPredicate, + (filterPredicate) -> additionalRestrictions = combinePredicates( additionalRestrictions, filterPredicate), entityDescriptor, rootTableGroup, AbstractSqlAstTranslator.rendersTableReferenceAlias( Clause.UPDATE ), @@ -1078,7 +1078,7 @@ public abstract class BaseSqmToSqlAstConverter extends Base } FilterHelper.applyBaseRestrictions( - (filterPredicate) -> additionalRestrictions = filterPredicate, + (filterPredicate) -> additionalRestrictions = combinePredicates( additionalRestrictions, filterPredicate), entityDescriptor, rootTableGroup, AbstractSqlAstTranslator.rendersTableReferenceAlias( Clause.DELETE ), diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/filter/subclass/singletable/SingleTableInheritanceFilterTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/filter/subclass/singletable/SingleTableInheritanceFilterTest.java index 7ecd696f52..c29acb5d16 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/filter/subclass/singletable/SingleTableInheritanceFilterTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/filter/subclass/singletable/SingleTableInheritanceFilterTest.java @@ -87,7 +87,7 @@ public class SingleTableInheritanceFilterTest { @Entity(name = "AbstractSuperClass") @DiscriminatorColumn(name = "DISC_COL", discriminatorType = DiscriminatorType.INTEGER) - @FilterDef(name = "dummy_filter", defaultCondition = "(ID IS NOT NULL)") + @FilterDef(name = "dummy_filter", defaultCondition = "(id IS NOT NULL)") @Filter(name = "dummy_filter") public static abstract class AbstractSuperClass { @Id