-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MonetaryAmountType: Problem with desc-sort on money attribute #505
Comments
@MichaelZett Thanks for reporting the issue. Since you already have a replicating test case, you could try to see how to add support for this feature. I won't have the time to investigate it, so if this is important to you, feel free to contribute this enhancement. |
Hi @vladmihalcea, the problem seems to be that from jpql to sql an orderBy on a UserType field leads to an orderBy on all attributes but only the last one gets added the order-direction. |
JPQL is parsed by Hibernate according to its internal ANTLR grammar. You could try to investigate whether a custom Type could influence it. |
Hi Vlad, I think it is not possible to influence that behavior with the custom type. |
I have no idea since I quit Red Hat almost 4 years ago. You could ask on the Hibernate Discourse forum. However, since Jadira has a solution, you could try to see how did they manage to get it working with their Type. |
Basically "luck". The order of their currency and amount attribute is the other way around - so here the desc is added to the amount what is what we expect. If it would be changed on your type it is breaking for users that overwrite the names of the attributes with the Column Annotation. The order there would need to be swapped as well. |
In that case, as you mentioned, adding a virtual column mapping using |
Ok, thanks. |
@MichaelZett I think this could be solved via a configuration that reverses the field order. That would fix the problem you are facing, but it will require setting a given configuration property explicitly. |
Hi Vlad,
we updated recently from jadiraUsertype to your hibernateTypes for the MonetaryAmount-Usertype. We think we found an issue with the type: It does not support descending sorting on MonetaryAmount fields in SpringData Repo like Jadira did.
Here is a repository where we built a test case with both user types: https://github.com/Bungi77/MonetaryAmountDeceasedSortingBug/
The hibernateTypes test fails while the Yadira test works as expected. Perhaps you find the time to look into that issue.
Thanks for your work and support.
The text was updated successfully, but these errors were encountered: