Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you programmatically turn off eager fetching with hibernate?

I have in my mapping an association to an eagerly loaded collection (lazy="false" fetch="subselect"). How can I turn that off programmatically with Hibernate when I do a query?

like image 990
Franz See Avatar asked Sep 03 '09 10:09

Franz See


1 Answers

In fact, it is supposed to be the other way around. You turn it off in the mapping, and activate it on specific use cases with a "fetch" in the query.

That's the way the Hibernate team sees it. There is no way in Hibernate to create a request that specifies "no-fetch" for a property...

like image 173
KLE Avatar answered Oct 15 '22 03:10

KLE