Class EntityExistsException

All Implemented Interfaces:
Serializable

public class EntityExistsException extends PersistenceException
Thrown by the persistence provider when:
  • a detached instance of an entity type is passed to EntityManager.persist(Object), or
  • any kind of uniqueness constraint is violated when an entity is inserted in the database.

The persistence provider is always permitted to postpone an EntityExistsException until execution of the resulting database insert operation. If a detached instance is passed to the persist operation, either:

  • an EntityExistsException is immediately thrown by persist(), or
  • an EntityExistsException or some other subtype of PersistenceException is thrown when the persistence context is flushed or when the transaction commits.

If an EntityExistsException is thrown by an EntityManager with a persistence context joined to an active transaction, the transaction is automatically marked for rollback when the exception is thrown.

Since:
1.0
See Also:
  • Constructor Details

    • EntityExistsException

      public EntityExistsException()
      Constructs a new EntityExistsException exception with null as its detail message.
    • EntityExistsException

      public EntityExistsException(String message)
      Constructs a new EntityExistsException exception with the specified detail message.
      Parameters:
      message - the detail message.
    • EntityExistsException

      public EntityExistsException(String message, Throwable cause)
      Constructs a new EntityExistsException exception with the specified detail message and cause.
      Parameters:
      message - the detail message.
      cause - the cause.
    • EntityExistsException

      public EntityExistsException(Throwable cause)
      Constructs a new EntityExistsException exception with the specified cause.
      Parameters:
      cause - the cause.