SQL generated even for FetchType.LAZY reference [message #1737561] |
Sun, 10 July 2016 01:52 |
Ari Meyer Messages: 13 Registered: July 2016 |
Junior Member |
|
|
I have a reference in an entity to its parent entity, and annotated it:
@ManyToOne(fetch=FetchType.LAZY)
to prevent it from making an unnecessary database call. Still, I'm seeing SQL generated to retrieve the parent entities, even for those that are common and should have been in the level 1 cache. I shouldn't have had to, but I also enabled the shared cache, and this, as expected, had no effect.
I then tried adding the query hint "eclipselink.batch" with a value of "x.task" (referring to the parent). Now there's only a single single SQL statement generated for the parent, which makes sense.
The batch hint is an improvement, but in the first case, at least, we shouldn't be seeing any DB call made for a LAZY reference, correct? Is there something I need to set to prevent this unnecessary call?
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02951 seconds