Sergey Chernov (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYTU0Mjc1OGEy...
) / Improvement (
https://hibernate.atlassian.net/browse/HHH-13884?atlOrigin=eyJpIjoiYTU0Mj...
) HHH-13884 (
https://hibernate.atlassian.net/browse/HHH-13884?atlOrigin=eyJpIjoiYTU0Mj...
) Follow javax.persistence.criteria.Order.reverse() contract (
https://hibernate.atlassian.net/browse/HHH-13884?atlOrigin=eyJpIjoiYTU0Mj...
)
Issue Type: Improvement Affects Versions: 6.0.0.Alpha4, 5.4.12 Assignee: Sergey Chernov (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) 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%...
)
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=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-13884#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=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100121- sha1:090dddf )