简体   繁体   中英

JPQL join for eager fetch association

Say I have entity A that is the parent with @OneToMany association to entity B. Also say I set fetch mode to eager. So when I use a JPQL to fetch my entities A base on some filter do I need to use join in order to get its children?

You have to use join when children are part of the query, for example:

select p 
from parent p 
inner join p.children c 
where c ...

but you don't have to use fetch before join to initialize entities.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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