I want to copy an object into another (its properties). This object is managed by Hibernate and has lazy collections. PropertyUtils.copyProperties() throws lazy exception.
Is there any way?
PS: I do not want to unproxy my object since I don't own it (its in another jar)
You can call Hibernate.initialize() on every lazy collectio of your original object before copying. Obviously, it would not work outside of a transaction, if yor object is detached from the Hibernate session. So, you have to initialize your lazy collections early enough.