Set中元素的Hibernate标准 [英] Hibernate Criteria for elements inside a Set

查看:100
本文介绍了Set中元素的Hibernate标准的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



Entity1包含Set entityTwos



我有一个实体,它包含一组另一个实体。希望为entityTwos中的id字段创建搜索条件。



我搜索了,但没有得到任何答案。有人有想法吗?

谢谢,
Sri

这很容易。例如:

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


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

解决方案

It was easy. Something like:

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

这篇关于Set中元素的Hibernate标准的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆