Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-6164

Unable to create new drug reference maps during drug creation

    XMLWordPrintable

Details

    Description

      I have been working on adding support for DrugReferenceMaps to Initializer, to allow specifying Mappings when creating/updating new Drugs from CSV.

      The paradigm here is that the row represents a Drug and associated properties, and saving the Drug should cascade down into the nested properties and save.

      So, if a new Drug contains new, unsaved DrugReferenceMaps which in turn contain new, unsaved ConceptReferenceTerms, saving a Drug should cascade down and also correctly save the DrugReferenceMaps and ConceptReferenceTerms without throwing any errors.

      Unfortunately this is not the case.

      Investigating, and comparing to how ConceptMap is implemented, I find 2 key differences in the ConceptMap.hbm.xml and DrugReferenceMap.hbm.xml files, which both lead to errors in saving Drugs:

      1. ConceptMap has an unsaved-value="0" attribute on it's id property
      2. ConceptMap has a cascade="save-update" attribute on it's conceptReferenceTerm association

      If I add both of these into the DrugReferenceMap.hbm.xml file, I am able to save a Drug with new, unsaved Maps and Terms.  If I do not, I get errors in saving.

      ibacher  / dkayiwa / mogoodrich  - FYI - should be easy enough to fix in core (and backport to whatever branches are desired).

      Gliffy Diagrams

        Attachments

          Activity

            People

              mseaton Mike Seaton
              mseaton Mike Seaton
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: