Mapping errors in entitymodel relations

XMLWordPrintable

    • 3

      JIRA entity model contains relations that result in generation of foreign keys that reference non-unique, non-primarykey fields. This is against the foreign key semantics and is not allowed at least in Oracle database. After fixing all the relations to have a unique name, there were 11 relations for which foreign keys couldn't be created.

      For example:
      <entity entity-name="Status" table-name="issuestatus" package-name="">
      ...
      <relation type="one" title="Child" rel-entity-name="Issue">
      <key-map field-name="id" rel-field-name="status"/>
      </relation>
      </entity>

      This relation results in the following fk-clause (with fk-name set as 'status_childissue_fk'):
      ALTER TABLE issuestatus ADD CONSTRAINT Status_ChildIssue_fk FOREIGN KEY (ID) REFERENCES jiraissue (issuestatus) INITIALLY DEFERRED

      I can't see any logic in that relation. Status does not have a childissue. There should be a relation the other way though, to ensure referential integrity of issue status. This would result in something like:
      ALTER TABLE jiraissue ADD CONSTRAINT ISSUE_STATUS_FK FOREIGN KEY (issuestatus) REFERENCES issuestatus (id) INITIALLY DEFERRED

              Assignee:
              Unassigned
              Reporter:
              Jarno Peltoniemi
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: