我的 hibernate hbm xml 有一个属性映射为
<set name="batchExceptionComments" table="BATCH_EXCEPTION_COMMENTS"
inverse="true" fetch="select" lazy="false" order-by="commentId">
<key>
<column name="EXCEPTION_ID" not-null="true" />
</key>
<one-to-many class="com.beans.BatchExceptionComments" />
</set>
我正在使用 order-by="commentId",它按 id 按升序排列集合。
我希望我的集合按降序排列。我应该做出哪些改变。
附注我不想更改我的 Java 代码。
使用的框架:Spring
使用的ORM:Hiebrnate
最佳答案
我找到了解决方案,请使用这个
order-by="commentId desc"
关于java - 希望通过hibernate hbm xml映射按降序排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53541447/