简体   繁体   English

休眠条件返回集

[英]Hibernate Criteria Returning Set

I Have a class which contains a Set of objects. 我有一个包含一组对象的类。 Using Hibernate Criteria, how can I return that Set of objects, as opposed to the objects of the class on which the query is being called? 使用Hibernate Criteria,如何返回该对象集,而不是调用查询的类的对​​象?

In standard HQL, I'm using the following : select o.routes from Operator o where o.name = :diamond , where routes is the set of objects I wish to retrieve. 在标准HQL中,我使用以下方法: select o.routes from Operator o where o.name = :diamond ,其中route是我希望检索的对象集。

I think you are looking for something like this How to add Distinct in Hibernate Criteria where in you are setting the projection to a specific object. 我认为您正在寻找类似“ 如何在休眠条件添加区别”的内容,其中您要将投影设置为特定对象。 you can also convert it to the class of that object. 您还可以将其转换为该对象的类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM