Hibernate Criteria for elements inside a Set

£可爱£侵袭症+ 提交于 2019-12-07 03:01:03

问题


I have one entity that contains a set of another entity.

Entity1 contains Set entityTwos

I want to create a search criteria for an "id" field inside entityTwos.

I searched, but didn't get any answers. Anybody have an idea?

Thanks, Sri


回答1:


It was easy. Something like:

criteria.createAlias("entityTwos", "entityTwo");
criteria.add(Restrictions.eq("entityTwo.id", ...));


来源:https://stackoverflow.com/questions/2941962/hibernate-criteria-for-elements-inside-a-set

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!