[hibernate-issues] [JIRA] (HHH-13990) org.hibernate.QueryException occurs When Join Fetch is used on toOne relationship along with memberOf filter on Element collection

Chandrasekar Rajasekar (JIRA) jira at hibernate.atlassian.net
Wed Apr 29 17:00:03 EDT 2020


Chandrasekar Rajasekar ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5ea9ddf0021ae30ba8f55c3f ) *updated* an issue

Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZDY1ZDE5MTcwNmU0NDEwMjg3MzUwOGI5Y2I4YjExZmUiLCJwIjoiaiJ9 ) / Bug ( https://hibernate.atlassian.net/browse/HHH-13990?atlOrigin=eyJpIjoiZDY1ZDE5MTcwNmU0NDEwMjg3MzUwOGI5Y2I4YjExZmUiLCJwIjoiaiJ9 ) HHH-13990 ( https://hibernate.atlassian.net/browse/HHH-13990?atlOrigin=eyJpIjoiZDY1ZDE5MTcwNmU0NDEwMjg3MzUwOGI5Y2I4YjExZmUiLCJwIjoiaiJ9 ) org.hibernate.QueryException occurs When Join Fetch is used on toOne relationship along with memberOf filter on Element collection ( https://hibernate.atlassian.net/browse/HHH-13990?atlOrigin=eyJpIjoiZDY1ZDE5MTcwNmU0NDEwMjg3MzUwOGI5Y2I4YjExZmUiLCJwIjoiaiJ9 )

Change By: Chandrasekar Rajasekar ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5ea9ddf0021ae30ba8f55c3f )

Query exception error occurs when element collection is included in where clause along with join fetch.

{noformat} SELECT example_Book FROM example.Author example_Author_fetch JOIN example_Authorfetch.books example_Book LEFT JOIN FETCH example_Book.publisher  WHERE :awards_3b62d810_0 MEMBER OF example_Book.awards AND example_Authorfetch=:example_Author_fetch{noformat}

java.lang.IllegalArgumentException: org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list \ [FromElement \ {explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=null,role=example.Book.publisher,tableName=Publisher,tableAlias=publisher3_,origin=author author0_,columns= \ {book2_.publisher_id ,className=example.Publisher}}] \ [SELECT example_Book FROM example.Author example_Author_fetch JOIN example_Authorfetch.books example_Book LEFT JOIN FETCH example_Book.publisher  WHERE :awards_3b62d810_0 MEMBER OF example_Book.awards AND example_Authorfetch=:example_Author_fetch ] {noformat}

{noformat}SELECT example_Book FROM example.Author example_Author_fetch JOIN example_Authorfetch.books example_Book LEFT JOIN FETCH example_Book.publisher  WHERE :awards_3b62d810_0 MEMBER OF example_Book.awards AND example_Authorfetch=:example_Author_fetch`{noformat}

Book and author has many-many relationship and book and publisher has many-one relationship. Awards is a Element collection of type List<string>.

Some of working queries:

{noformat}SELECT example_Book FROM example.Book AS example_Book  LEFT JOIN FETCH example_Book.publisher  WHERE :awards_3e8093d5_0 MEMBER OF example_Book.awards `{noformat}

{noformat}SELECT example_Book FROM example.Author example_Author_fetch JOIN example_Authorfetch.books example_Book LEFT JOIN FETCH example_Book.publisher  WHERE example_Book.publishDate > 😛ublishDate_fd2879ac_0 AND example_Authorfetch=:example_Author_fetch`{noformat}

( https://hibernate.atlassian.net/browse/HHH-13990#add-comment?atlOrigin=eyJpIjoiZDY1ZDE5MTcwNmU0NDEwMjg3MzUwOGI5Y2I4YjExZmUiLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-13990#add-comment?atlOrigin=eyJpIjoiZDY1ZDE5MTcwNmU0NDEwMjg3MzUwOGI5Y2I4YjExZmUiLCJwIjoiaiJ9 )

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#100125- sha1:e06514a )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200429/1b540185/attachment.html 


More information about the hibernate-issues mailing list