使用join休眠标准

时间:2018-06-29 11:28:54

标签: java mysql hibernate join criteria

如何为以下mysql创建休眠条件查询?

SELECT * FROM orders JOIN address ON address.id = orders.toaddress WHERE orders.id=7;

我尝试过这样的事情:

Criteria c1 =HibernateSession.createCriteria(s,Orders.class);
c1.setFetchMode("toaddress",FetchMode.JOIN);
List <Address> c = c1.list();
for (Address a: c) {
   a.getAddress();  
}

提前感谢所有帮助!

0 个答案:

没有答案