posted 14 years ago
I have the following hbm mapping
Here the status_id is defined as a not-null field in databade.
In the code I was creating a new object for childInstrumentCrossRefs, putting an existing InstrumentStatus into it and attaching it with the parent InstrumentCrossRef. There are some updates in the parent object as well.
As the set is using cascade update, I am updating the parent object only and all its child objects should also be saved. However, I get a constraint violation exception for the field STATUS_ID.
When I updated the cascade to 'none' for the childInstrumentCrossRefs, and updated the code to save individual instances of parent and children, the code started working fine.
I read somewhere that cascade='save-update' is not recommended for many-to-many 'http://docs.jboss.org/hibernate/core/3.3/reference/en/html/objectstate.html#objectstate-transitive'.
Can any one elaborate the reason for of it?
Thanks,
Me