All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.ebean.DuplicateKeyException Maven / Gradle / Ivy

There is a newer version: 15.8.0
Show newest version
package io.ebean;

/**
 * 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 {@link Transaction#rollbackAndContinue()}. * *

{@code
 *
 *   try (Transaction txn = database.beginTransaction()) {
 *
 *     try {
 *       ...
 *       database.save(bean);
 *       database.flush();
 *     } catch (DuplicateKeyException e) {
 *       // carry on processing using the transaction
 *       txn.rollbackAndContinue();
 *       ...
 *     }
 *
 *     txn.commit();
 *   }
 *
 * }
*/ public class DuplicateKeyException extends DataIntegrityException { private static final long serialVersionUID = -4771932723285724817L; /** * Create with a message and cause. */ public DuplicateKeyException(String message, Throwable cause) { super(message, cause); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy