Top Description Methods
javax.persistence

public Interface EntityTransaction


Interface used to control transactions on resource-local entity managers. The EntityManager.getTransaction() method returns the EntityTransaction interface.
Since
Java Persistence 1.0

Method Summary

Modifier and TypeMethod and Description
public void
begin()

Start a resource transaction.

public void
commit()

Commit the current resource transaction, writing any unflushed changes to the database.

public boolean

Returns:

boolean indicating whether the transaction has been marked for rollback
getRollbackOnly
()

Determine whether the current resource transaction has been marked for rollback.

public boolean

Returns:

boolean indicating whether transaction is in progress
isActive
()

Indicate whether a resource transaction is in progress.

public void
rollback()

Roll back the current resource transaction.

public void
setRollbackOnly()

Mark the current resource transaction so that the only possible outcome of the transaction is for the transaction to be rolled back.

Method Detail

beginback to summary
public void begin()

Start a resource transaction.

Exceptions
IllegalStateException:
if isActive() is true
commitback to summary
public void commit()

Commit the current resource transaction, writing any unflushed changes to the database.

Exceptions
IllegalStateException:
if isActive() is false
RollbackException:
if the commit fails
getRollbackOnlyback to summary
public boolean getRollbackOnly()

Determine whether the current resource transaction has been marked for rollback.

Returns:boolean

boolean indicating whether the transaction has been marked for rollback

Exceptions
IllegalStateException:
if isActive() is false
isActiveback to summary
public boolean isActive()

Indicate whether a resource transaction is in progress.

Returns:boolean

boolean indicating whether transaction is in progress

Exceptions
PersistenceException:
if an unexpected error condition is encountered
rollbackback to summary
public void rollback()

Roll back the current resource transaction.

Exceptions
IllegalStateException:
if isActive() is false
PersistenceException:
if an unexpected error condition is encountered
setRollbackOnlyback to summary
public void setRollbackOnly()

Mark the current resource transaction so that the only possible outcome of the transaction is for the transaction to be rolled back.

Exceptions
IllegalStateException:
if isActive() is false