- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- javax.persistence.PersistenceException
-
- io.ebean.DataIntegrityException
-
- io.ebean.DuplicateKeyException
-
- All Implemented Interfaces:
Serializable
public class DuplicateKeyException extends DataIntegrityException
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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DuplicateKeyException(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
-
-