org.firebirdsql.jca

## Class FBLocalTransaction

- java.lang.Object
- - org.firebirdsql.jca.FBLocalTransaction

All Implemented Interfaces:
  javax.resource.cci.LocalTransaction, FirebirdLocalTransaction

    public class FBLocalTransaction
    extends java.lang.Object
    implements FirebirdLocalTransaction, javax.resource.cci.LocalTransaction

The class `FBLocalTransaction` implements LocalTransaction both in the cci and spi meanings. A flag is used to distinguish the current functionality. This class works by delegating the operations to the internal implementations of the XAResource functionality in FBManagedConnection.

Version:
  1.0
Author:
  David Jencks

### Nested Class Summary

Nested Classes
`static class` `FBLocalTransaction.FBLocalXid`

### Field Summary

Fields
`protected javax.resource.spi.ConnectionEvent` `beginEvent`
`protected javax.resource.spi.ConnectionEvent` `commitEvent`
`protected FBManagedConnection` `mc`
`protected javax.resource.spi.ConnectionEvent` `rollbackEvent`
`protected javax.transaction.xa.Xid` `xid`

### Constructor Summary

Constructors
Constructor and Description
`FBLocalTransaction(FBManagedConnection mc, FBConnection c)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `begin()` Begin a local transaction.
`void` `commit()` Commit a local transaction.
`javax.transaction.xa.Xid` `getXid()` Get the associated Xid.
`void` `internalBegin()` Perform the internal operations to begin a local transaction.
`void` `internalCommit()` Perform the internal processing to commit a local transaction.
`void` `internalRollback()` Perform the internal processing to rollback a local transaction.
`boolean` `inTransaction()` Check whether a started transaction is associated with the current database connection.
`void` `rollback()` Rollback a local transaction.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### mc

    protected final FBManagedConnection mc

#### xid

    protected javax.transaction.xa.Xid xid

#### beginEvent

    protected final javax.resource.spi.ConnectionEvent beginEvent

#### commitEvent

    protected final javax.resource.spi.ConnectionEvent commitEvent

#### rollbackEvent

    protected final javax.resource.spi.ConnectionEvent rollbackEvent

### Constructor Detail

#### FBLocalTransaction

    public FBLocalTransaction(FBManagedConnection mc,
                              FBConnection c)

### Method Detail

#### getXid

    public javax.transaction.xa.Xid getXid()

Get the associated Xid.

Specified by:
  `getXid` in interface `FirebirdLocalTransaction`
Returns:
  instance of `Xid` representing a transaction ID that is managed by this local transaction.

#### inTransaction

    public boolean inTransaction()
                          throws javax.resource.ResourceException

Check whether a started transaction is associated with the current database connection.

Specified by:
  `inTransaction` in interface `FirebirdLocalTransaction`
Returns:
  `true` if managed connection is participating in transaction.
Throws:
  `javax.resource.ResourceException` - if operation cannot be completed.

#### begin

    public void begin()
               throws javax.resource.ResourceException

Begin a local transaction.

Specified by:
  `begin` in interface `javax.resource.cci.LocalTransaction`
Throws:
  `javax.resource.ResourceException` - generic exception if operation fails
  `javax.resource.spi.LocalTransactionException` - error condition related to local transaction management
  `javax.resource.spi.ResourceAdapterInternalException` - error condition internal to resource adapter
  `javax.resource.spi.EISSystemException` - EIS instance specific error condition

#### internalBegin

    public void internalBegin()
                       throws javax.resource.ResourceException

Perform the internal operations to begin a local transaction.

Throws:
  `javax.resource.ResourceException` - generic exception if operation fails
  `javax.resource.spi.LocalTransactionException` - error condition related to local transaction management
  `javax.resource.spi.ResourceAdapterInternalException` - error condition internal to resource adapter
  `javax.resource.spi.EISSystemException` - EIS instance specific error condition

#### commit

    public void commit()
                throws javax.resource.ResourceException

Commit a local transaction.

Specified by:
  `commit` in interface `javax.resource.cci.LocalTransaction`
Throws:
  `javax.resource.ResourceException` - generic exception if operation fails
  `javax.resource.spi.LocalTransactionException` - error condition related to local transaction management
  `javax.resource.spi.ResourceAdapterInternalException` - error condition internal to resource adapter
  `javax.resource.spi.EISSystemException` - EIS instance specific error condition

#### internalCommit

    public void internalCommit()
                        throws javax.resource.ResourceException

Perform the internal processing to commit a local transaction.

Throws:
  `javax.resource.ResourceException` - generic exception if operation fails
  `javax.resource.spi.LocalTransactionException` - error condition related to local transaction management
  `javax.resource.spi.ResourceAdapterInternalException` - error condition internal to resource adapter
  `javax.resource.spi.EISSystemException` - EIS instance specific error condition

#### rollback

    public void rollback()
                  throws javax.resource.ResourceException

Rollback a local transaction.

Specified by:
  `rollback` in interface `javax.resource.cci.LocalTransaction`
Throws:
  `javax.resource.ResourceException` - generic exception if operation fails
  `javax.resource.spi.LocalTransactionException` - error condition related to local transaction management
  `javax.resource.spi.ResourceAdapterInternalException` - error condition internal to resource adapter
  `javax.resource.spi.EISSystemException` - EIS instance specific error condition

#### internalRollback

    public void internalRollback()
                          throws javax.resource.ResourceException

Perform the internal processing to rollback a local transaction.

Throws:
  `javax.resource.ResourceException` - generic exception if operation fails
  `javax.resource.spi.LocalTransactionException` - error condition related to local transaction management
  `javax.resource.spi.ResourceAdapterInternalException` - error condition internal to resource adapter
  `javax.resource.spi.EISSystemException` - EIS instance specific error condition