Uploaded image for project: 'The AndroMDA project'
  1. The AndroMDA project
  2. ANDROMDA-359

Hibernate: cascading problem in one-to-one composition

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      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" .../>

        Attachments

          Activity

            People

            • Assignee:
              overheat overheat
              Reporter:
              mattes3 Matthias Bohlen
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: