简体   繁体   English

如何在Hibernate中使用fetch ='join'?

[英]How to use fetch='join' in Hibernate?

I encountered a problem on usering Hibernate. 我在使用Hibernate时遇到问题。 Table A one-to-one Table B and Table A one-to-one Table C.Now I use the method get(A.class, id), but Hibernate generate two sql:the first one a join b, the second is "select c" when use the property c in a, That is fetch="join" is fail in a and c, Who can help me find the reason? 表A一对一的表B和表A一对一的表C.现在我使用get(A.class,id)方法,但是Hibernate生成两个sql:第一个sql联接b,第二个是在a中使用属性c时“选择c”,即a和c中的fetch =“ join”失败,谁能帮我找到原因?

from Cat as cat
inner join cat.mate as mate
left outer join cat.kittens as kitten

More examples here 这里有更多例子

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

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