OK I apparently missed something whiule reading JPWH. It appears that my issue is associated with the fact that cacscade was not set properly. In this case I set it to all (other options may work)
Setting the parent to Hibernate.initialize(object) made no discernable change to the children's children. However, Hibernate.initialize(object) does work if you do this for the lazy object itself. This requires the methods in the POJO to know about Hibernate, which for me is not desireable.
Setting the parent to getSessionFactory().getCurrentSession().lock(object,LockMode.NONE); Did affect the children such that while they were in a lazy detached state originally, they were reattached to the session and no "No Session" exception was thrown. The parent object in this case is not a proxy as far as I can tell from the variable inspection.
Lesson learned watch the cascade option on many-to-one
|