[hibernate-issues] [JIRA] (HHH-13884) Follow javax.persistence.criteria.Order.reverse() contract
Sergey Chernov (JIRA)
jira at hibernate.atlassian.net
Fri Feb 28 08:04:37 EST 2020
Sergey Chernov ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A668d35e1-fa15-4a2a-a3e8-663025345475 ) *created* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYTU0Mjc1OGEyYmM2NGFhZGFjYmJiYTM4OGQ4ODIyMmIiLCJwIjoiaiJ9 ) / Improvement ( https://hibernate.atlassian.net/browse/HHH-13884?atlOrigin=eyJpIjoiYTU0Mjc1OGEyYmM2NGFhZGFjYmJiYTM4OGQ4ODIyMmIiLCJwIjoiaiJ9 ) HHH-13884 ( https://hibernate.atlassian.net/browse/HHH-13884?atlOrigin=eyJpIjoiYTU0Mjc1OGEyYmM2NGFhZGFjYmJiYTM4OGQ4ODIyMmIiLCJwIjoiaiJ9 ) Follow javax.persistence.criteria.Order.reverse() contract ( https://hibernate.atlassian.net/browse/HHH-13884?atlOrigin=eyJpIjoiYTU0Mjc1OGEyYmM2NGFhZGFjYmJiYTM4OGQ4ODIyMmIiLCJwIjoiaiJ9 )
Issue Type: Improvement Affects Versions: 6.0.0.Alpha4, 5.4.12 Assignee: Sergey Chernov ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A668d35e1-fa15-4a2a-a3e8-663025345475 ) Components: hibernate-core Created: 28/Feb/2020 05:04 AM Labels: core jpa2.2 Priority: Major Reporter: Sergey Chernov ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A668d35e1-fa15-4a2a-a3e8-663025345475 )
javax.persistence.criteria.Order.reverse() method javadoc explicitly declares:
public interface Order {
/**
* Switch the ordering.
* @ return a new <code>Order</code> instance with the reversed ordering
*/
Order reverse();
This interface is implemented by two classes:
1. In master branch (5.4.x versions) - by org.hibernate.query.criteria.internal.OrderImpl with this implementation:
...
public Order reverse() {
ascending = !ascending;
return this ;
}
...
It returns this instead of new object
2. In wip/6.0 branch there is another class
org.hibernate.query.sqm.tree.select.SqmSortSpecification that has the same problem:
@Override
public JpaOrder reverse() {
this.sortOrder = this.sortOrder == null ? SortOrder.DESCENDING : sortOrder.reverse();
return this ;
}
Proposal: respect the contract and return new created object.
( https://hibernate.atlassian.net/browse/HHH-13884#add-comment?atlOrigin=eyJpIjoiYTU0Mjc1OGEyYmM2NGFhZGFjYmJiYTM4OGQ4ODIyMmIiLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-13884#add-comment?atlOrigin=eyJpIjoiYTU0Mjc1OGEyYmM2NGFhZGFjYmJiYTM4OGQ4ODIyMmIiLCJwIjoiaiJ9 )
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:090dddf )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200228/b1f2b971/attachment.html
More information about the hibernate-issues
mailing list