## org.h2.mvstore
Class TransactionStore.Transaction

    java.lang.Object
      org.h2.mvstore.TransactionStore.Transaction

Enclosing class:
  TransactionStore

    public static class TransactionStore.Transaction

extends java.lang.Object

A transaction.

Field Summary
`static int` `STATUS_CLOSED` The status of a closed transaction (committed or rolled back).
`static int` `STATUS_OPEN` The status of an open transaction.
`static int` `STATUS_PREPARED` The status of a prepared transaction.

Method Summary
`void` `commit()` Commit the transaction.
`long` `getId()` Get the transaction id.
`java.lang.String` `getName()` Get the name of the transaction.
`int` `getStatus()` Get the transaction status.

`

`<K,V> TransactionStore.TransactionMap<K,V>`

`

`openMap(java.lang.String name)`
Open a data map where reads are always up to date.

`

`<K,V> TransactionStore.TransactionMap<K,V>`

`

`openMap(java.lang.String name, long readVersion)`
Open a data map where reads are based on the specified version / savepoint.

`void` `prepare()` Prepare the transaction.
`void` `rollback()` Roll the transaction back.
`void` `rollbackToSavepoint(long savepointId)` Roll back to the given savepoint.
`void` `setName(java.lang.String name)` Set the name of the transaction.
`long` `setSavepoint()` Create a new savepoint.

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

Field Detail

### STATUS_OPEN

    public static final int STATUS_OPEN

  The status of an open transaction.

  See Also:
    Constant Field Values

### STATUS_PREPARED

    public static final int STATUS_PREPARED

  The status of a prepared transaction.

  See Also:
    Constant Field Values

### STATUS_CLOSED

    public static final int STATUS_CLOSED

  The status of a closed transaction (committed or rolled back).

  See Also:
    Constant Field Values

Method Detail

### getId

    public long getId()

  Get the transaction id.

  Returns:
    the transaction id

### getStatus

    public int getStatus()

  Get the transaction status.

  Returns:
    the status

### setName

    public void setName(java.lang.String name)

  Set the name of the transaction.

  Parameters:
    `name` - the new name

### getName

    public java.lang.String getName()

  Get the name of the transaction.

  Returns:
    name the name

### setSavepoint

    public long setSavepoint()

  Create a new savepoint.

  Returns:
    the savepoint id

### openMap

    public <K,V> TransactionStore.TransactionMap<K,V> openMap(java.lang.String name)

  Open a data map where reads are always up to date.

  Type Parameters:
    `K` - the key type
    `V` - the value type
  Parameters:
    `name` - the name of the map
  Returns:
    the transaction map

### openMap

    public <K,V> TransactionStore.TransactionMap<K,V> openMap(java.lang.String name,
                                                              long readVersion)

  Open a data map where reads are based on the specified version / savepoint.

  Type Parameters:
    `K` - the key type
    `V` - the value type
  Parameters:
    `name` - the name of the map
    `readVersion` - the version used for reading
  Returns:
    the transaction map

### rollbackToSavepoint

    public void rollbackToSavepoint(long savepointId)

  Roll back to the given savepoint. This is only allowed if the transaction is open.

  Parameters:
    `savepointId` - the savepoint id

### prepare

    public void prepare()

  Prepare the transaction. Afterwards, the transaction can only be committed or rolled back.

### commit

    public void commit()

  Commit the transaction. Afterwards, this transaction is closed.

### rollback

    public void rollback()

  Roll the transaction back. Afterwards, this transaction is closed.