Hibernate Criteria API orderBy 和嵌入元素
假设我有一个 Report
实体。其中有 @Embeddable ReportPeriod
,其中包含 Integer Month
和 Integer Year
字段。当我尝试按 ReportPeriod reportPeriod
对 Report 报告
进行排序时,它会按 月
和 年对
。如何更改排序顺序(report
进行排序年
,然后月
)。可以通过任何注释来解决这个问题吗?
Lets say I have a Report
entity. Inside it there is @Embeddable ReportPeriod
which has Integer month
and Integer year
fields. When i try to sort my Report report
by its ReportPeriod reportPeriod
it sorts report
by month
and year
. How to change the order of sort (year
and then month
). Can this be solved by any of the annotations?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想您想按休眠标准加载多个报告并按嵌入的月份和年份对它们进行排序?
但我不是 100% 确定 Order 是否可以应用于 @Embeddable,但我希望如此。
I guess you want to load several reports by hibernate criteria and sort them by its embebedded month and year?
But I am not 100% sure if Order can be applied to an @Embeddable, but is expect it.