Hi,
I have following manyToOne lazy association to the same model object (recurssive inside one class) defined in my domain object (with bytecode instrumentation enabled):
@ManyToOne
@LazyToOne(LazyToOneOption.NO_PROXY)
@JoinColumn(name = "NAME1", referencedColumnName = "NAME2", nullable = true, insertable = false, updatable = false)
Lazy loading works fine but I'm unable to initialize this association through query using FETCH JOIN phrase.
If I construct HQL query with JOIN FETCH phrase on given association object, then I can see from log Hibernate constructing SQL joining both sides. But on the returned object there is CGLIB FieldInterceptorImpl linked to, which assumes, that given association is not initialized yet and any access to this association causes lazy.init. except (because session is closed allready).
Is there any way to initialize that association with HQL fetch join query phrase or is there only way to call Hibernate.initialize that causes one more select to be executed? I would prefer "joining" but could not get it to work as I want.
S.
Ilhan
|