简体   繁体   中英

Hibernate dynamic load strategy for second level entities

 class SomeClass {
  List strings;
  OtherClass otherClass;
 }



class OtherClass {
  List listOfOtherClass
 }

So I have SomeClass and I can load it's strings dynamicly via criteria's setFetchMode("strings", someFetchStrategy) . But I want to load listOfOtherClass too. I tried doing setFetchMode("listOfOtherClass", JOIN) , setFetchMode("otherClass", JOIN) but failed.

Pretty simple. You need to do setFetchMode("otherClass.listOfOtherClass", JOIN)

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