Find by id and Filters

Hi,
I see a number of topics on different resources and a number of issues in jira - some says revert, some says apply, and I’m a bit lost on tracking the final decision and motivation…
Can someone shed a light on this topic please ?
Seems with the current state of things filters are applied ?
Is this final decision ?
Because my application fails because of this, specifically not really find by ID method, but when I call refresh - it can’t find my entity because of filters applied suddenly applied.
Is this expected that refresh also is affected by filters?!

1 Like

It was discussed and decided that filters should never be applied for “by id lookups”. That’s the final decision. I previously thought that supporting filters there is a good idea, but it turned out to be a bad idea because of backwards compatibility problems, hence we reverted the change to support filters in this scenario.
AFAIR we discussed that if enough users request this, we might add filtering for by id lookups as opt-in feature, but not at this time. Your best chance to get this feature back is to create a new JIRA issue and attract many like minded users to vote on it.

Thank you for your answer.
" decided that filters should never be applied for “by id lookups”. That’s the final decision."

Do you know for what hibernate versions this is applicable ?
Seems 6.1.7 applies filters to find by id
6.2.2 doesn’t not apply.

do you know if will there be 6.1.8 ? an if so will filter apply on find by id or not ?

Currently I’m stuck with my upgrade as with 6.1.7 my application is started by not working as expected because of filters are applied during find by id and seems refresh operation and seems some collection initialization operations
And with 6.2.2 my application doesn’t start because of reported bug about same filter def for on different entities.
And I’m trying to plan my next steps

6.1 became unmaintained ever since 6.2 released. We only noticed the mistake in 6.2.2, so that’s why this is the first version that doesn’t apply the filter anymore for by id lookups.

And with 6.2.2 my application doesn’t start because of reported bug about same filter def for on different entities.

Which issue is that? Please post the link.

I see, thanks. So will aim on upgrading to 6.2.2+ stream, hopefully this issue will be fixed soon.
Here it is:
https://hibernate.atlassian.net/jira/software/c/projects/HHH/issues/HHH-16581
I also attached there zip and PR for test case…to make test case pass you can downgrade hibernate to 6.1.7

Link to this forum topic:

1 Like

Has it been considered that this breaks the @TenantId functionality? someone already opened a bug for that I think HHH-16561

1 Like

Looks like it broke the multi tenancy feature → [HHH-16835] - Hibernate JIRA

See [HHH-16830] - Hibernate JIRA

1 Like