Jakarta Persistence (JPA) Interface
jakarta.persistence.EntityTransaction
Interface used to control transactions on resource-local entity managers. The
EntityManager.getTransaction method returns the EntityTransaction interface.- Since:
- Jakarta Persistence (JPA) 1.0
The Database Connection using JPA article explains how to use
EntityTransaction.Public Instance Methods
void commit()- Throws:
- ifIllegalStateExceptionisActiveis false.- if the commit fails.RollbackException
- Since:
- Jakarta Persistence (JPA) 1.0
boolean getRollbackOnly()- Returns:
- boolean indicating whether the transaction has been marked for rollback.
- Throws:
- ifIllegalStateExceptionisActiveis false.
- Since:
- Jakarta Persistence (JPA) 1.0
Integer getTimeout()- Since:
- Jakarta Persistence (JPA) 3.2
boolean isActive()- Returns:
- boolean indicating whether transaction is in progress.
- Throws:
- if an unexpected error condition is encountered.PersistenceException
- Since:
- Jakarta Persistence (JPA) 1.0
void rollback()- Throws:
- ifIllegalStateExceptionisActiveis false.- if an unexpected error condition is encountered.PersistenceException
- Since:
- Jakarta Persistence (JPA) 1.0
void setRollbackOnly()- Throws:
- ifIllegalStateExceptionisActiveis false.
- Since:
- Jakarta Persistence (JPA) 1.0
This is a hint.
- Parameters:
timeout- the timeout, in seconds, or null to indicate that the database server should set the timeout
- Since:
- Jakarta Persistence (JPA) 3.2