At Diamond we got a Java exception that originated from a constraint in the database table crystal_has_uuid - it seems the application was trying to set the crystalId column to NULL, which is not allowed because of the constraint.
I've made a fix that deletes all rows in the crystal_has_uuid table associated with the crystalId before the application goes on to delete the row in the Crystal table.
I will commit the fix shortly. If this is not a problem at the ESRF and you're concerned it will break something, I can embrace the fix in an "if DLS" condition.