# Interface CADatabaseTransactionType

All Superinterfaces:
  `AutoCloseable`

public interface CADatabaseTransactionType extends AutoCloseable
A database transaction. If the transaction is closed, it is automatically rolled back.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `void`
  `commit()`
  Commit the transaction.
  `<T extends CADatabaseQueriesType>
  T`
  `queries(Class<T> queryClass)`
  Obtain queries for the transaction.
  `void`
  `rollback()`
  Roll back the transaction.
  `void`
  `setUserId(CAUserID newUserId)`
  Set the transaction's user ID.
  `CAUserID`
  `userId()`

- ## Method Details

  - ### close

    void close() throws CADatabaseException
    Specified by:
      `close` in interface `AutoCloseable`
    Throws:
      `CADatabaseException`

  - ### queries

    <T extends CADatabaseQueriesType> T queries(Class<T> queryClass) throws CADatabaseException
    Obtain queries for the transaction.
    Type Parameters:
      `T` - The query type
    Parameters:
      `queryClass` - The query type
    Returns:
      Queries
    Throws:
      `CADatabaseException` - On errors

  - ### rollback

    void rollback() throws CADatabaseException
    Roll back the transaction.
    Throws:
      `CADatabaseException` - On errors

  - ### commit

    void commit() throws CADatabaseException
    Commit the transaction.
    Throws:
      `CADatabaseException` - On errors

  - ### setUserId

    void setUserId(CAUserID newUserId)
    Set the transaction's user ID.
    Parameters:
      `newUserId` - The user ID

  - ### userId

    CAUserID userId()
    Returns:
      The transaction's user ID