Short summary:
update a parent and add a new chiild to it. saveorupdate the parent saves the child but loses the updates to the parent. Huh?
Longer description:
I've built a JSP/Spring/Hibernate app using the Spring web support.
I have an "Issue" object that contains a Set of "Responses".
When someone chooses to add a "Response" to an "Issue" they hit an "Add Response" link, an AddResponseController gets invoked which generates, as a form backing object, a new "Response" and sets the "Issue" on the response.
In the form I can then edit the new Response and also make changes to a couple of fields from the Issue (which the form gets from the Response passed in).
Then on submit the controller does a Save on the Issue and because I've setting the Hibernate mapping file to cascade saves and updates, so does the Response.
Checking the database the Response does get added correctly but the updates I've made to the Issue are written to the database. Anyone have any idea why?[[/u]


Reply With Quote