Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
2.1.0
-
None
-
Java 8, Windows 10, MariaDB 10.2.13
Description
After executing a DELETE statement on a row which cannot be deleted due to violation of a referential contraint, an SQL exception is thrown as expected. The exception is:
java.sql.SQLIntegrityConstraintViolationException: (conn:1569) Cannot delete or update a parent row: a foreign key constraint fails (`VM_51_TEST`.`AMA_SYSTYPEUSAGE_SYSTYPE`, CONSTRAINT `F_SYSTPUSGSTP_STP` FOREIGN KEY (`SYSTYPE_ID`) REFERENCES `AMA_SYSTYPE` (`SYSTYPE_ID`))
However, when the same DELETE statement is executed as a batch (PreparedStatement.executeBatch()), then an incorrect exception is thrown:
java.sql.BatchUpdateException: Error reading results Index: 1, Size: 1
calling getCause() returns: java.sql.SQLException: Error reading results Index: 1, Size: 1
(expected result of getCause() is SQLIntegrityConstraintViolationException as in non-batch mode)
Details on the BatchUpdateException :
vendor code: 0
updateCounts: [-3,-3]
(everything else is null or empty)