Class JpaTransaction
java.lang.Object
de.xima.fc.persistence.impl.tx.JpaTransaction
- All Implemented Interfaces:
IJpaTransaction, Closeable, AutoCloseable
Implementation of
IJpaTransaction that manages a JPA transaction using an EntityManager. This class
ensures that the transaction is properly started, committed, or rolled back as needed.
Note: This class is designed for internal use only. Plugins should not use this interface. This class may be moved to a different package in the future, so plugins should not depend on it.
- Since:
- 8.5.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the JPA transaction context, committing the JPA transaction if set to do so.voidcommit()Marks the transaction to be committed when the transaction context isclosed.javax.persistence.EntityManagerem()Returns the JPA EntityManager associated with this transaction context.static IJpaTransactionforEntityManager(javax.persistence.EntityManager em) booleanisCommit()Checks if the transaction is marked to be committed when it is closed.voidrollback()Marks the transaction to be rolled back when the transaction context isclosed.
-
Method Details
-
forEntityManager
-
close
public void close()Description copied from interface:IJpaTransactionCloses the JPA transaction context, committing the JPA transaction if set to do so.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceIJpaTransaction- See Also:
-
commit
public void commit()Description copied from interface:IJpaTransactionMarks the transaction to be committed when the transaction context isclosed.- Specified by:
commitin interfaceIJpaTransaction- See Also:
-
em
public javax.persistence.EntityManager em()Description copied from interface:IJpaTransactionReturns the JPA EntityManager associated with this transaction context.- Specified by:
emin interfaceIJpaTransaction- Returns:
- the EntityManager
-
isCommit
public boolean isCommit()Description copied from interface:IJpaTransactionChecks if the transaction is marked to be committed when it is closed.- Specified by:
isCommitin interfaceIJpaTransaction- Returns:
- true if the transaction is set to be committed, false otherwise
- See Also:
-
rollback
public void rollback()Description copied from interface:IJpaTransactionMarks the transaction to be rolled back when the transaction context isclosed.- Specified by:
rollbackin interfaceIJpaTransaction- See Also:
-