Holger's Java API

## com.antelmann.db
Class UserTransactionListener

    java.lang.Object
      com.antelmann.db.TransactionListener.Adapter
          com.antelmann.db.UserTransactionListener

All Implemented Interfaces:
  TransactionListener

    public class UserTransactionListener

extends TransactionListener.Adapter

a special transaction listener that will set the current database user to the one specified by the user retriever on each transaction begin. When the transaction has ended, the database user will be set back to the one it previously was.

Since:
  31.08.2013, 02:26:28
Author:
  holger

Nested Class Summary

Nested classes/interfaces inherited from interface com.antelmann.db.TransactionListener
`TransactionListener.Adapter`

Constructor Summary
`UserTransactionListener(User user)`
`UserTransactionListener(ValueRetriever<User> retriever)`

Method Summary
`void` `transactionAborted(DBTransaction transaction)` called after a database transaction was aborted; the transaction is already inactive.
`void` `transactionBegin(DBTransaction transaction)` called upon beginning a transaction (the transaction is already active)
`void` `transactionCommitted(DBTransaction transaction)` called after a successful database commit; the transaction is already inactive.

Methods inherited from class com.antelmann.db.TransactionListener.Adapter
`finishTransaction, prepareToCommit`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### UserTransactionListener

    public UserTransactionListener(User user)

### UserTransactionListener

    public UserTransactionListener(ValueRetriever<User> retriever)

Method Detail

### transactionBegin

    public void transactionBegin(DBTransaction transaction)

  Description copied from interface: `TransactionListener`
  called upon beginning a transaction (the transaction is already active)

  Specified by:
    `transactionBegin` in interface `TransactionListener`
  Overrides:
    `transactionBegin` in class `TransactionListener.Adapter`

### transactionCommitted

    public void transactionCommitted(DBTransaction transaction)

  Description copied from interface: `TransactionListener`
  called after a successful database commit; the transaction is already inactive. Note that you cannot start a new transaction within the call of this method, since subsequent listeners would not have a chance to react on this transaction end. If the implementation of this method tries to begin a new transaction, a `TransactionException` will be thrown. If you need to access/update resources of this database from this method, start a new thread that opens a new transaction.

  Specified by:
    `transactionCommitted` in interface `TransactionListener`
  Overrides:
    `transactionCommitted` in class `TransactionListener.Adapter`

### transactionAborted

    public void transactionAborted(DBTransaction transaction)

  Description copied from interface: `TransactionListener`
  called after a database transaction was aborted; the transaction is already inactive. Note that you cannot to start a new transaction within the call of this method, since subsequent listeners would not have a chance to react on this transaction end. If the implementation of this method tries to begin a new transaction, a `TransactionException` will be thrown. If you need to access/update resources of this database from this method, start a new thread that opens a new transaction.

  Specified by:
    `transactionAborted` in interface `TransactionListener`
  Overrides:
    `transactionAborted` in class `TransactionListener.Adapter`

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads