Class DataIntegrityViolationException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
com.codename1.backend.DataAccessException
com.codename1.backend.DataIntegrityViolationException
A statement broke a rule the schema declares: a duplicate key, a foreign key with no row behind it, a NOT NULL or CHECK constraint.
Named after Spring's, and meant for the same use: telling a duplicate apart
from a ConcurrencyFailureException or any other DataAccessException.
Running the same work again repeats it. The failures recognized are:
- PostgreSQL: every SQLSTATE of class 23 (23505 unique, 23503 foreign key, 23502 not null, 23514 check).
- MySQL and MariaDB: every SQLSTATE of class 23, and the codes that carry it -- 1062 duplicate entry, 1451/1452 foreign key, 1048 column cannot be null.
- SQLite: a "constraint failed" error, of whichever kind.
An ORM session reports a database failure as an unchecked exception with
this one as its cause; isCauseOf(Throwable) finds it there.
-
Constructor Summary
ConstructorsConstructorDescriptionDataIntegrityViolationException(String message) DataIntegrityViolationException(String message, Throwable cause) -
Method Summary
Methods inherited from class Throwable
addSuppressed, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
DataIntegrityViolationException
-
DataIntegrityViolationException
-
-
Method Details
-
isCauseOf
Whether
failureis an integrity violation or was caused by one, however many exceptions it has been wrapped in since.failure: what was caught; null answers false
-