Error updating passport data
There's an issue updating existing data in Genesys.
exception is org.hibernate.exception.ConstraintViolationException: could not execute batch data={"instituteCode":"TWN001","accessionNumber":"VI002470A-G","historic":false,"origCty":"PHL","storage":[],"duplSite":["NOR051","KOR011"],"taxonomy":{"genus":"Vigna","species":"radiata","spAuthor":"(L.) R. Wilczek","subtaxa":"var. radiata","subtAuthor":null},"coll":{"collDate":null,"collSite":null,"collNumb":null,"collSrc":null,"collMissId":null,"collCode":[],"collName":[],"collInstAddress":[]},"breederCode":[],"breederName":[],"cropName":"Mungbean","acquisitionDate":"19750930","sampStat":null,"available":true,"mlsStatus":null,"acceName":["(CES 28 X ML-18)"],"otherNumb":[],"donorCode":null,"donorName":null,"donorNumb":"PI 425827","ancest":null,"latitude":null,"longitude":null,"elevation":null,"coordinateUncertainty":null,"coordinateDatum":null,"georeferenceMethod":null}
org.springframework.dao.DataIntegrityViolationException: 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
...
at org.genesys2.server.service.worker.AccessionUploader$$EnhancerBySpringCGLIB$$91b07599.upsertAccessions(<generated>)
at org.genesys2.server.api.v1.AccessionUploadController.upsert1By1(AccessionUploadController.java:146)
...
Caused by: java.sql.BatchUpdateException: (conn=1573286) Cannot delete or update a parent row: a foreign key constraint fails (`genesys`.`accession_collect_name`, CONSTRAINT `FK_g6h5uuvq16105ljx8r1jjxojr` FOREIGN KEY (`collectId`) REFERENCES `accession_collect` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION)
Need a unit test and a fix!