[hibernate-issues] [JIRA] (HHH-14148) Invalid SQL when null precedence, @OrderBy and entity graph are used

Amr Mostafa (JIRA) jira at hibernate.atlassian.net
Tue Aug 11 19:19:21 EDT 2020


Amr Mostafa ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A4af3ec09-e6c6-4bc1-a4cc-7a112dc7970d ) *updated* an issue

Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNDc3NzQ5NDRhYTJkNGU3MWEyMGQxMTVjN2NjYjZjYjgiLCJwIjoiaiJ9 ) / Bug ( https://hibernate.atlassian.net/browse/HHH-14148?atlOrigin=eyJpIjoiNDc3NzQ5NDRhYTJkNGU3MWEyMGQxMTVjN2NjYjZjYjgiLCJwIjoiaiJ9 ) HHH-14148 ( https://hibernate.atlassian.net/browse/HHH-14148?atlOrigin=eyJpIjoiNDc3NzQ5NDRhYTJkNGU3MWEyMGQxMTVjN2NjYjZjYjgiLCJwIjoiaiJ9 ) Invalid SQL when null precedence, @OrderBy and entity graph are used ( https://hibernate.atlassian.net/browse/HHH-14148?atlOrigin=eyJpIjoiNDc3NzQ5NDRhYTJkNGU3MWEyMGQxMTVjN2NjYjZjYjgiLCJwIjoiaiJ9 )

Change By: Amr Mostafa ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A4af3ec09-e6c6-4bc1-a4cc-7a112dc7970d )

Hibernate generates an invalid SQL for the case below, that basically resembles this:

{noformat}SELECT ... ORDER BY field nulls last nulls last{noformat}

(duplicate null precedence at the end)

The issue is constantly reproducible with a simple setup where you have 2 entities with a {{@OneToMany}} relation with {{@OrderBy}} annotation on the collection. Then at query time specify that relation in the entity graph hint.

I'm attaching the test scenario, it has 2 almost identical test cases:
1. With entity graph hint: Fails
2. Without entity graph hint: Succeeds

Please let me know if there is any other detail I could specify to help.

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

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#100142- sha1:98e8dd4 )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200811/08a14571/attachment.html 


More information about the hibernate-issues mailing list