Affects Version/s: None
Fix Version/s: None
The templates for Hibernate always generate a
<...-to-one ... cascade="delete" />
mapping for 1-to-1 composition relationship. If the entity class on the parent end of the composition has a tagged value for default-cascade="save-update", this does not make sense any more because calls to save() and update() are not cascaded when the generated mapping above merely says cascade="delete".
Instead, the correct mapping should look like this: The example is Parent<>-Child with a black diamond on the Parent side of the 1-to-1 composition):
- If Parent has default-cascade="save-update" or default-cascade="all" then the association to Child should be mapped with <many-to-one cascade="all" ... />
- If Parent has defaultcascade="none" or default-cascade=<not specified> then the association to Child should be mapped with <many-to-one cascade="delete" .../>