I would like to eagerly fetch all fields of an object using HQL, overriding any fetch strategy annotations. Is there any special HQL syntax for doing that? Or do I need to add inner join fetch
to each of the associative fields?
Asked
Active
Viewed 887 times
1 Answers
0
This is from Hibernate Docs implies that you can override lazy with eager, but not the other way around
If you are using property-level lazy fetching (with bytecode instrumentation), it is possible to force Hibernate to fetch the lazy properties in the first query immediately using fetch all properties.
Unusually, it looks like you can if you use the Criteria API to go from eager to lazy. Just call setFetchMode(FetchMode.LAZY) on the relevant join