@Filter not working with session.load by ID

Hello,

I saw that there was no plan to enable @Filter for entity retrieval by ID: https://hibernate.atlassian.net/browse/HHH-11485

But unfortunately, our confidentiality mechanisms are based on the data filter.

WHERE CONFIDENTIALITE=ENTREPRISE_NAME

Suddenly that would prohibit using session.get () or load () or getId () otherwise we risk recovering data that should not be visible.

It’s still very restrictive …

The solution to still not pass a Query does not satisfy me either: java - How can I get an Entity by ID whilst applying a Hibernate @Filter? - Stack Overflow -filter

Difficult to form an opinion of how to do it, an idea?

Thank you
Vincent

I saw that the problem did not arise with the @Where for the soft-delete, phew! :slight_smile:

I saw that there were these 2 limitations to @filter : cache + direct access :

We fixed this in Hibernate 6.0: https://hibernate.atlassian.net/browse/HHH-14772

1 Like

Ah top!
Only the find or also the get and load?

All access methods will now consider the filters properly.

1 Like