Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-4927

CLONE -HHH-3334 Cascade-save breaks if parent ID is assigned (delays insert) and child has identity ID (early insert)

XMLWordPrintable

    • Release Notes
    • Workaround Exists
    • Hide

      do not use cascade and save the table with assigned PK first

      Show
      do not use cascade and save the table with assigned PK first
    • The cascade-save operation was incorrectly handling auto-incremented Primary Key (PK) tables that linked to parent tables with an assigned PK. The fix now allows the cascade-save operation to handle the parent-child relationship between tables.
    • Documented as Resolved Issue

      Consider:

      a table with an assigned PK (i.e. not auto-increment), let's call this "A"
      Another table ("B") linked to the table listed above but with it's PK set to auto-increment.
      Now if you try to save B with cascading switched on, it will break. From the little debugging I've done it looks like:

      a) hibernate detects that A needs to be saved first, but puts it into some sort of queue.
      b) when it hits B, it short-circuits this save queue and tries to save B immediately so as to obtain a PK reference for B. This fails since A hasn't been yet been saved so it's link is still null.

      ----------
      http://opensource.atlassian.com/projects/hibernate/browse/HHH-3334

              rrajasek@redhat.com Rajesh Rajasekaran
              shaozliu Strong Liu(刘少壮) (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: