@Filter definition not applied to JPA find method

Description

I am using the FilterDef and Filter annotations in order to use a parameterized filter that I set at runtime.
This gets executed correctly when I do a query using the entityManager create query methods, but when I use the entityManager.find, the filter is not added to the query.
Using the '@Where' annotation does add the clause but this annotation can't be parameterized as far as I know.

My environment is jBoss EAP 7 that uses hibernate 5.0.9

Environment

jBoss EAP 7 using Hibernate 5.0.9

Activity

Show:
Gail Badner
September 27, 2017, 9:19 PM

This works as designed. Please see the documentation in section:
http://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/Hibernate_User_Guide.html#mapping-column-filter

See the box starting, "Filters apply to entity queries, but not to direct fetching"

Michal Růžička
April 23, 2019, 11:24 PM

Would you know what was the rationale behind the design decision you are referring to? Could you provide a link to a relevant discussion?

Gail Badner
April 24, 2019, 12:19 AM

, discussions happen in many places; there is likely a discussion on jira issues where filters were first implemented, or possibly the hibernate-dev mailing list or freenode chatroom.

Assignee

Gail Badner

Reporter

Jacob Ven

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure