java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
jakarta.persistence.PersistenceException
io.ebean.DataIntegrityException
io.ebean.DuplicateKeyException
- All Implemented Interfaces:
Serializable
Thrown when a duplicate is attempted on a unique constraint.
In terms of catching this exception with the view of continuing processing
using the same transaction look to use Transaction.rollbackAndContinue()
.
try (Transaction txn = database.beginTransaction()) {
try {
...
database.save(bean);
database.flush();
} catch (DuplicateKeyException e) {
// carry on processing using the transaction
txn.rollbackAndContinue();
...
}
txn.commit();
}
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDuplicateKeyException
(String message, Throwable cause) Create with a message and cause. -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
DuplicateKeyException
Create with a message and cause.
-