Uploader: Clearing accessionId.coll
While testing integration with GG-CE I stumbled upon an error where
the existing record in the database has some collecting data, including one value in accession.accessionId.coll.collName
list and a date in accession.accessionId.coll.collDate
. The new upload sets:
...
"coll": {
"collDate": null,
"collSite": null,
"collNumb": null,
"collSrc": null,
"collMissId": null,
"collCode": [],
"collName": [],
"collInstAddress": []
},
...
This should effectively remove the AccessionCollect
record from the database in AccessionUploader
at:
It results in Cannot delete or update a parent row: (sandbox
.accession_collect_name
, CONSTRAINT FK_g6h5uuvq16105ljx8r1jjxojr
FOREIGN KEY (collectId
) REFERENCES accession_collect
(id
) ON DELETE NO ACTION ON UPDATE NO ACTION):
Upload resulted in: ERROR instCode=MEX002 doi=10.18730/G8G4B acceNumb=CIMMYTMA 71 genus=Zea
error=could not execute batch; SQL [delete from accession_collect where id=? and version=?]; constraint [null];
nested exception is org.hibernate.exception.ConstraintViolationException: could not execute batch
could not execute batch
(conn=266448) Cannot delete or update a parent row:
a foreign key constraint fails
(`sandbox`.`accession_collect_name`, CONSTRAINT `FK_g6h5uuvq16105ljx8r1jjxojr` FOREIGN KEY (`collectId`) REFERENCES `accession_collect` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION)
Please add a unit test and figure this out.