Skip to content Skip to sidebar Skip to footer

Hibernate Updating One To Many Cascaded

I have two entities, which have one to many relationships. Purchase ----------------< lineCommand I have mapped those entities together, and everything works fine at least when

Solution 1:

obj.getLineItems() returns a set of detached instances (they are not associated with the current Hibernate session). The easiest way to resolve the issue is to merge the Purchase before committing the transaction:

purchase = session.merge(purchase);

This way merge operation will be cascaded to the associated LineCommand instances.


Post a Comment for "Hibernate Updating One To Many Cascaded"