[JIRA] (HHH-16715) accept value() or element() in place of elements() and key() or index() in place of indices()
by Gavin King (JIRA)
Gavin King ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *updated* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYjA5YjAwNmZj... ) / Improvement ( https://hibernate.atlassian.net/browse/HHH-16715?atlOrigin=eyJpIjoiYjA5Yj... ) HHH-16715 ( https://hibernate.atlassian.net/browse/HHH-16715?atlOrigin=eyJpIjoiYjA5Yj... ) accept value() or element() in place of elements() and key() or index() in place of indices() ( https://hibernate.atlassian.net/browse/HHH-16715?atlOrigin=eyJpIjoiYjA5Yj... )
Change By: Gavin King ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... )
Writing the docs, I _still_ struggle to explain the role of the {{elements()}} and {{indices()}} functions, and I think they’re still quite confusing.
So what if we finally deprecated them and let you just use {{element()}}, {{value()}}, {{index()}}, and {{key()}} instead?
That is, we would accept:
# {{max(element(experiment.measurements))}}, {{max(index(record.revisions))}}
# {{0.0 < every element(experiment.measurements)}}, {{1 = any index(record.revisions)}}
# {{1 in index(record.revisions)}}, {{"hibernate" in element(document.tags)}}
# {{exists(element(experiment.measurements))}}
In case cases 1 and 4 , the revised syntax reads significantly better.
In case 2, the revised syntax reads better if you use the {{every}} / {{any}} form of the quantifiers, or worse if you use the {{all}}/ {{some}} version.
In case 3, the revised syntax reads definitely worse. But how useful is {{in}} with collections when we also have:
* {{member of}} , and
* the option of writing {{1 = any index(record.revisions)}}.
Or perhaps we could just make {{elements}} a synonym for {{element}} and {{indices}} a synonym for {{index}} and let you write whatever you like.
Thoughts?
( https://hibernate.atlassian.net/browse/HHH-16715#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-16715#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=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100225- sha1:da60ad2 )
2 years, 3 months
[JIRA] (HHH-16715) accept value() or element() in place of elements() and key() or index() in place of indices()
by Gavin King (JIRA)
Gavin King ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *created* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiM2UyYjllZjhk... ) / Improvement ( https://hibernate.atlassian.net/browse/HHH-16715?atlOrigin=eyJpIjoiM2UyYj... ) HHH-16715 ( https://hibernate.atlassian.net/browse/HHH-16715?atlOrigin=eyJpIjoiM2UyYj... ) accept value() or element() in place of elements() and key() or index() in place of indices() ( https://hibernate.atlassian.net/browse/HHH-16715?atlOrigin=eyJpIjoiM2UyYj... )
Issue Type: Improvement Assignee: Unassigned Components: query-hql Created: 29/May/2023 12:44 PM Priority: Major Reporter: Gavin King ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... )
Writing the docs, I still struggle to explain the role of the elements() and indices() functions, and I think they’re still quite confusing.
So what if we finally deprecated them and let you just use element() , value() , index() , and key() instead?
That is, we would accept:
* max(element(experiment.measurements)) , max(index(record.revisions))
* 0.0 < every element(experiment.measurements) , 1 = any index(record.revisions)
* 1 in index(record.revisions) , "hibernate" in element(document.tags)
In case 1, the revised syntax reads significantly better.
In case 2, the revised syntax reads better if you use the every / any form of the quantifiers, or worse if you use the all / some version.
In case 3, the revised syntax reads definitely worse. But how useful is in with collections when we also have:
* member of , and
* the option of writing 1 = any index(record.revisions).
Or perhaps we could just make elements a synonym for element and indices a synonym for index and let you write whatever you like.
Thoughts?
( https://hibernate.atlassian.net/browse/HHH-16715#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-16715#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=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100225- sha1:da60ad2 )
2 years, 3 months