Details
-
Bug
-
Status: Closed
-
Should
-
Resolution: Fixed
-
None
-
None
-
None
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:
- ConceptMap has an unsaved-value="0" attribute on it's id property
- 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).