Stuart Purdie (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5e569e7...
) *commented* on HHH-12104 (
https://hibernate.atlassian.net/browse/HHH-12104?atlOrigin=eyJpIjoiM2I3Nj...
)
Re: @Where clause is ignored when eagerly loading ManyToOne association (
https://hibernate.atlassian.net/browse/HHH-12104?atlOrigin=eyJpIjoiM2I3Nj...
)
We’ve encountered a case which I believe is really an instance of this bug.
We have a set of (~100) Entities (most with soft delete implemented), and a moderately
interwoven set of dependancies with them. Whilst everything works fine with direct loading
(as all the key relationships between soft deletable Entities are Lazy), if we use
CriteriaBuilder and are doing a join between two soft deleted Entities, the @Where
annotation is not utilised for the Entity that is the target of the join.
I believe (although have not proven) that this is an instance of this problem, as the use
of the explicit join through the CriteriaBuilder makes those joins explicitly eager;
irrespective of what the ‘default’ specified on the Entity itself is.
(This is with Hibernate 5.4.3).
In order to work around this, we have to ensure we include the @Where condition in each
query; which does somewhat reduce the value of the @Where, particularly when there’s 4-5
such joins in the query.
(
https://hibernate.atlassian.net/browse/HHH-12104#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-12104#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100121- sha1:cefda43 )