DataSourceTransaction

public class DataSourceTransaction implements Transaction

DataSourceTransaction is an implementation of a DAO transaction. It should not be created directly and is usually created through DataSourceDAOFactory.

Author:Hugo Y. K. Lam

See also: DataSourceDAOFactory

Constructors

DataSourceTransaction

protected DataSourceTransaction(DataSourceDAOFactory dsFactory)

Creates a new instance of DataSourceTransaction.

Parameters:
  • dsFactory – the data source factory which creates this transaction.
Throws:
  • DAOException – if the no data source factory specified.

Methods

begin

public void begin()

Begins the transaction.

Throws:
  • DAOException – if unable to begin the transaction or the transaction has already begun.

See also: hk.hku.cecid.piazza.commons.dao.Transaction.begin()

commit

public void commit()

Commits the transaction.

Throws:

See also: hk.hku.cecid.piazza.commons.dao.Transaction.commit()

getConnection

public Connection getConnection()

Gets the connection that this transaction manages.

Throws:
  • DAOException – if the transaction has not begun or has been ended.
Returns:

the connection this transaction manages.

releaseConnection

public void releaseConnection()

Releases the connection that this transaction manages.

rollback

public void rollback()

Rolls back the transaction.

Throws:

See also: hk.hku.cecid.piazza.commons.dao.Transaction.rollback()