HHH-14968 - Support for auto-enabled filters

This commit is contained in:
Steve Ebersole 2024-03-20 16:35:03 -05:00
parent 0d0f8754ca
commit 7f489fed4a
1 changed files with 48 additions and 0 deletions

View File

@ -86,6 +86,54 @@ class AnEntity {
}
----
[[auto-filters]]
== Support for Auto Enabled Filters
Filters can now be automatically enabled for each Session and StatelessSession
[source,java]
----
@FilterDef(
name="active-filter",
condition="status = true",
autoEnabled=true
)
@Filter(name="active-filter")
@Entity
class DeletableEntity {
...
}
----
Can be combined with the ability to dynamically resolve condition parameters, e.g.
[source,java]
----
class TenantIdResolver implements Supplier<String> {
@Override
public String get() {
return SomeContext.determineTenantId();
}
}
@FilterDef(
name="tenancy-filter",
condition="tenant_id = :tenantId",
autoEnabled=true,
parameter = @ParamDef(
name="tenantId",
type=String.class,
resolver=TenantIdResolver.class
)
)
@Filter(name="tenancy-filter")
@Entity
class SensitiveData {
...
}
----
[[sqm-mutation-joins]]
== Joined Mutation Queries