Change from “Session” to “StatelessSession” and I can fetch my Class complete
-
03-10-2019 - |
Question
I use a stateless session and the follow HQL.
CreateQuery("select a from Address a")
My Address Class has many BankDetails but i can't access. If i use a normal session it works. What can I do?
Solution
Use a fetch join to pull in the bank details explicitly rather than relying on an implicit load when you first access the BankDetails
property:
CreateQuery("select a from Address a inner join fetch a.BankDetails")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow