BioMaterial.getParent() return null after changing the (single) parent of a biomaterial
|Reported by:||Nicklas Nordborg||Owned by:||Nicklas Nordborg|
A biomaterial that has a single parent is a special case since that information is also stored in the
BioMaterials table (
parent_id column). Biomaterials with no or multiple parents have null in this column. The parent information is in all cases also stored in the
When using the web gui to switch the parent for a biomaterial that has a single parent, the new parent is added first and the old parent is then removed. The problem is that adding the new parent makes the biomaterial to have two parents and the
parent_id column is cleared. When the old parent is removed the column is never populated with the id of the new parent. The result is that the
BioMaterial.hasSingleParent() method return false, and the
BioMaterial.getParent() return null.
The workaround in the web interface is to first remove the old parent, save and then add the new parent in a second edit operation.
The BASE core code need to be fixed so that removing parent items also triggers an update to the
parent_id column when there is only one left.