当前位置: 代码迷 >> Java Web开发 >> hibernate的诠注@OrderBy的排序原理
  详细解决方案

hibernate的诠注@OrderBy的排序原理

热度:30   发布时间:2016-04-13 22:16:02.0
hibernate的注解@OrderBy的排序原理?
private Set<DeptEntity> cDeptEntity = new HashSet<DeptEntity>();//下属

@OrderBy("deptId asc")  
public Set<DeptEntity> getDeptEntity() {  

网上查了很久,但是不清楚hibernate是如何保证cDeptEntity 输出的结果有序的?
------解决思路----------------------
最终转化的还是sql的order by啊
------解决思路----------------------
引用:
@fengmy11
那只能保证查出来的结果有序,把结果按顺序放入set后,输出的顺序不一定就是放入时的顺序啊?


set会按照他自己的原则排序
  相关解决方案