Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-1896

Flattened attributes don't work with optimistic locking on

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.2.M1
    • None
    • Core Library
    • None

    Description

      Flattened attributes can not be modified and saved with if you have optimistic locking turned on for a to-one relationship in the same entity with the flattened attribute.

      For example, say you have Artist and Painting and a flattened attribute "artistName" on Painting and you set this to a new value. And you also have optimistic locking on the Painting.artist relationship. It tries to generate SQL for the flattened object (Artist) that includes the to-one relationship foreign key from the source object (Painting) and fails because the column is not found:

      UPDATE ARTIST SET NAME = ? WHERE ID IS NULL AND ARTIST_ID = ?
      Column 'ARTIST_ID' is either not in any table in the FROM list...

      A minimal example is attached.

      Attachments

        1. 0001-Fix-flattened-attributes.patch
          2 kB
          John Huss
        2. cayenne-mvn-snippet.zip
          26 kB
          John Huss

        Activity

          People

            Unassigned Unassigned
            johnthuss John Huss
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: