Hibernate 6.2 and FilterDefs name uniques

We have a logic that pre-processes entity classes and dynamically adds FilterDef(s) depending on some conditions.
This seems to works before 6.2, now I get “Multiple ‘@FilterDef’ annotations define a filter named” exception on startup…
So it is possible that entity A will have filter defs for FilterA and FilterB
and entity B will have Filter Def for FilterB, and seems for hibernate 6.2 it becomes a problem for some reason.
I was trying to find an issue where it was done, so better understand motivation, can someone help me to find it or understand the root cause of this change ?
Also docs doesn’t say anything about unique name for filter defs and the context of uniqueness, like should it be package wide, or persistence unit ? I have 4 persistence units so I would like to understand in what context it should be unique

This looks like a bug. Please create an issue in the issue tracker(https://hibernate.atlassian.net) with a test case(hibernate-test-case-templates/JPAUnitTestCase.java at main · hibernate/hibernate-test-case-templates · GitHub) that reproduces the issue.

Thanks, just for tracking: issue created [HHH-16581] - Hibernate JIRA

1 Like