[hibernate-issues] [JIRA] (HHH-12104) @Where clause is ignored when eagerly loading ManyToOne association

Stuart Purdie (JIRA) jira at hibernate.atlassian.net
Wed Feb 26 12:55:58 EST 2020


Stuart Purdie ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5e569e7a691b8a0c95c3e73d ) *commented* on HHH-12104 ( https://hibernate.atlassian.net/browse/HHH-12104?atlOrigin=eyJpIjoiM2I3NjdhOGRmYmYyNGExNDhjYTIyNzM5MTU1OThhNjIiLCJwIjoiaiJ9 )

Re: @Where clause is ignored when eagerly loading ManyToOne association ( https://hibernate.atlassian.net/browse/HHH-12104?atlOrigin=eyJpIjoiM2I3NjdhOGRmYmYyNGExNDhjYTIyNzM5MTU1OThhNjIiLCJwIjoiaiJ9 )

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=eyJpIjoiM2I3NjdhOGRmYmYyNGExNDhjYTIyNzM5MTU1OThhNjIiLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-12104#add-comment?atlOrigin=eyJpIjoiM2I3NjdhOGRmYmYyNGExNDhjYTIyNzM5MTU1OThhNjIiLCJwIjoiaiJ9 )

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.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100121- sha1:cefda43 )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200226/d4bdabd1/attachment.html 


More information about the hibernate-issues mailing list