日期:2014-05-16  浏览次数:20383 次

hibernate使用细节汇总

hibernate3.3.1

如果在hql中使用了join,则order by 中关联其他表时,比如order by othertable.name时会报错的。如果没有使用join,则没问题,hibernate自动帮你关联到并且排序成功。

可能是不支持where中关联字段查询

org.hibernate.QueryException: illegal attempt to dereference collection [orders0_.uid.orderitems] with element property reference [gdsid] [select count( b ) from com.atech.stock.entity.Orders b where b.arrivaltime between :p1 and :p2 and b.billstateid= :p3 and b.billtype=1 and b.orderitems.gdsid = :p4 ]见http://zw7534313.iteye.com/blog/607436

上面我说过order by关联其他表是可以成功的。