在休眠标准中添加多个类
我有以下代码
ArrayList<String> city = 'Anniston';
Criteria crit = session.createCriteria(CandidateResumeInfo.class);
crit.add(Restrictions.eq("resumeSearchable", 1));
现在我想添加以下条件
crit.add(Restrictions.in("cities", city));
,但问题是城市列不在 CandidateResumeInfo.class 中,而是在 CandidateInfo 类中。
知道如何在上述条件中添加此条件,如何在上述条件中添加 CandidateInfo 类。
我猜我需要连接或链接这两个表,但是如何连接或链接实体类?
谢谢
I have the below code
ArrayList<String> city = 'Anniston';
Criteria crit = session.createCriteria(CandidateResumeInfo.class);
crit.add(Restrictions.eq("resumeSearchable", 1));
Now i want to add below criteria
crit.add(Restrictions.in("cities", city));
but the problem is that cities column is not in CandidateResumeInfo.class its in CandidateInfo Class.
Any idea how to add this criteria as well in the above one,how to add CandidateInfo class as well in the above criteria.
guess i need to do join or link these two tables but how ,and will there be any changes in the entity classes ?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您没有描述您的关联,但我认为它会类似于
在这种情况下您需要类似
http://docs.jboss.org/hibernate/core/3.3/reference/en/html/querycriteria.html
检查有关关联的部分。
You didn't describe your associations but I assume it would be something like
In this case you would need something like
http://docs.jboss.org/hibernate/core/3.3/reference/en/html/querycriteria.html
check section about associations.