0
我需要做一个搜索,其中包括导航到子元素,然后备份到根/父。我如何使用Criteria API做这样的事情?休眠标准API
举个例子,我有:
Criteria crit = getSessionFactory().getCurrentSession()
.createCriteria(TherapistImpl.class);
现在我需要去用户类来获得其与用户相关联的地址(组地址):
crit.createCriteria("user")
.createCriteria("addresses")
.add(Restrictions.eq("postcode", postCode));
但是现在我已经完成了这个工作,我需要返回来从父类TherapyImpl获得其他一对多关联。
crit.createCriteria("therapyProvisions")
.add(Restrictions.eq("type", searchByValueSelected));
但hibernate认为这是指我们之前链接和创建的用户标准。
所以我创建了多个标准?有没有一种方法可以导航回树上?
感谢您的意见 保罗