简体   繁体   English

休眠左联接使用

[英]Hibernate left join using with

Reading the hibernate documentation, you find the following on Left Joins here . 阅读休眠文档,您可以在此处的“左连接”中找到以下内容。

from Cat as cat
left join cat.kittens as kitten
with kitten.bodyWeight > 10.0

Assume the following setup. 假定以下设置。

Cat1
 Kitten1 (bodyWeight:11.0)
 Kitten2 (bodyWeight:12,5)

Cat2 
 Kitten3 (bodyWeight:17.1)
 Kitten4 (bodyWeight:5,2)

Cat3

Given the setup, will the query above give us the following result? 有了设置,上面的查询会给我们以下结果吗?

Cat1
 Kitten1 (bodyWeight:11.0)
 Kitten2 (bodyWeight:12,5)

Cat2 
 Kitten3 (bodyWeight:17.1)
 ...

Cat3

yes and if there was another cat 是的,如果还有另一只猫

Cat4
 Kitten1 (bodyWeight:1.0)
 Kitten2 (bodyWeight:2,5)

Cat4 would also be returned, but with no kittens Cat4也将被退回,但没有小猫

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

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