Is there a good way to determine why Hibernate/JPA performs a query. I have two entities linked by
@OneToOne(cascade = {CascadeType.REMOVE, CascadeType.PERSIST},
fetch = FetchType.LAZY)
When fetching one entity, the other one is also queried. I am trying to find out how to avoid that (actual lazy loading).
Thanks,
-dennis
First of all,
FetchType.LAZYis a hint for persistence provider, provider is not required to follow it.Perhaps in this case provider have to check whether relationship is
null(otherwise provider can create a proxy object for lazy access to the entity).You can try the following:
null, mark it asoptional = false