Results 1 to 2 of 2

Thread: updating object problem: hibernate + spring

  1. #1

    Default updating object problem: hibernate + spring

    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]

  2. #2
    Join Date
    Aug 2004
    Location
    Southampton, UK
    Posts
    826

    Default

    Edward,

    Without seeing your code, I am unable to tell exactly why this is occuring. However, you should try enabling Hibernate debugging and see if the appropriate SQL queries are being executed and whether Hibernate is actually detecting the changes in the object.

    Rob

Similar Threads

  1. Replies: 2
    Last Post: Oct 10th, 2005, 05:12 PM
  2. Loosing my SecureContext
    By sklakken in forum Security
    Replies: 3
    Last Post: Jul 21st, 2005, 01:44 PM
  3. Replies: 2
    Last Post: May 26th, 2005, 02:30 AM
  4. Replies: 3
    Last Post: Nov 19th, 2004, 07:16 PM
  5. Replies: 5
    Last Post: Aug 27th, 2004, 07:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •