Uploaded image for project: 'Syncope'
  1. Syncope
  2. SYNCOPE-323

REST: create turns into update for some entities

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0.5, 1.1.0
    • 1.1.0
    • core
    • None

    Description

      I have recently found that some REST create requests are treated as update.

      For example, try to create a new schema on the admin console and provide a name of another existing schema: you won't get any warning; only, the existing schema definition will be completely replaced by the newly inserted entry.

      After some investigations, I've found that this happens for external resources, schema, derived schema and virtual schema.
      Such entities have in common the fact that the JPA @Id is non-generated.
      The way how saving is handled (via EntityManager#merge()) finally turns an expected create into an update.

      I don't find such behavior as correct, hence I would propose to throw an exception, in the REST create methods for the entities named above, in case the key of the entity being created is already present.

      [1] http://markmail.org/message/kxrh7pgwuijwyfik

      Attachments

        Activity

          People

            ilgrosso Francesco Chicchiriccò
            ilgrosso Francesco Chicchiriccò
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: