public final class JpaUtil extends Object
| Constructor and Description |
|---|
JpaUtil() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isConstraintViolation(Exception e)
Returns true if the given exception is a unique constraint violation.
|
static void |
rollbackQuietly(javax.persistence.EntityManager entityManager)
Rolls back a transaction.
|
public static boolean isConstraintViolation(Exception e)
EntityExistsException
when the row already exists. However, this is not always the case, based on
experience. Or perhaps it only throws the exception if the entity is already
loaded from the DB and exists in the EntityManager.e - the exceptionpublic static void rollbackQuietly(javax.persistence.EntityManager entityManager)
entityManager - the entity managerCopyright © 2015 JBoss, a division of Red Hat. All rights reserved.