From 8dad6d34e2e95509062bd18b9e5b463f68a9f74a Mon Sep 17 00:00:00 2001 From: Gavin King Date: Sun, 31 Aug 2025 09:54:25 +1000 Subject: [PATCH] add a code example of @Filter applied to a one-to-many --- .../main/java/org/hibernate/annotations/Filter.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/Filter.java b/hibernate-core/src/main/java/org/hibernate/annotations/Filter.java index 729bc60f38ec..fb08c8f791d1 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/Filter.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/Filter.java @@ -33,6 +33,16 @@ * } * *

+ * Similarly, the filter could be applied to a one-to-many association + * like this: + *

+ * @OneToMany(mappedBy = "provider")
+ * @Filter(name = "Current",
+ *         deduceAliasInjectionPoints = false,
+ *         condition = "{alias}.year = extract(year from current_date)")
+ * List<Course> courses;
+ * 
+ *

* If an entity or collection has no {@code @Filter} annotation * with the name of a given filter, it is not affected by that * filter.