OctaviusSessionImpl

internal class OctaviusSessionImpl(rawConnection: Connection, ownsConnection: Boolean = true) : OctaviusSession

Internal implementation of the OctaviusSession interface.

This class wraps a raw JDBC Connection (which could be pooled) and delegates operations to the underlying OctaviusConnection.

Constructors

Link copied to clipboard
constructor(rawConnection: Connection, ownsConnection: Boolean = true)

Properties

Link copied to clipboard
open override var autoCommit: Boolean

Specifies whether the session operates in auto-commit mode. If true, each individual statement is treated as a separate transaction.

Link copied to clipboard
open override val copy: CopyManager

Provides an API for performing PostgreSQL COPY operations.

Link copied to clipboard
open override val largeObjects: LargeObjectManager

Provides an API for managing PostgreSQL Large Objects.

Link copied to clipboard
open override var networkTimeout: Int

The network timeout (in milliseconds) for operations executed on this session.

Link copied to clipboard

Handles asynchronous PostgreSQL notifications (LISTEN / NOTIFY mechanism).

Link copied to clipboard
Link copied to clipboard
open override var readOnly: Boolean

Indicates whether this session is currently in read-only mode.

Link copied to clipboard
open override val transaction: TransactionManager

Provides a high-level API for executing operations within transaction scopes (e.g., required, nested). Automatically manages commits and rollbacks based on block execution outcomes.

Link copied to clipboard

The transaction isolation level for this session.

Link copied to clipboard

The current transaction state of this session (Idle, In Transaction, or Failed).

Link copied to clipboard
open override val typeManager: TypeManager

Manages PostgreSQL types and their OIDs, providing functionality for registration and resolution.

Functions

Link copied to clipboard
open override fun abort()

Manually aborts the connection, forcing the underlying connection pool (like HikariCP) to evict it instead of returning it to the pool.

Link copied to clipboard
open override fun cancelQuery()

Attempts to cancel the currently executing query on this session.

Link copied to clipboard
open override fun close()

Ends the session, undoing the per-session state it left on its connection and giving that connection up - back to the pool it was borrowed from, or closed outright.

Link copied to clipboard
open override fun commit()

Commits the current transaction, persisting all changes made within it.

Link copied to clipboard

Creates a query with named parameters (e.g., @name, @id) which will be translated into positional parameters under the hood.

Link copied to clipboard
open override fun createNativeQuery(sql: String): NativeQuery

Creates a native query from the provided SQL string using standard PostgreSQL positional parameters (e.g. $1, $2).

Link copied to clipboard
open override fun getSearchPath(): List<String>

Retrieves the current search_path configured for this session.

Link copied to clipboard
open override fun isValid(timeout: Int): Boolean

Checks if this session is still valid and the underlying connection is alive.

Link copied to clipboard
open override fun releaseSavepoint(savepoint: OctaviusSavepoint)

Releases the specified savepoint from the current transaction.

Link copied to clipboard
open override fun reloadTypes()

Reloads the database types and updates internal OID mappings.

Link copied to clipboard
open override fun rollback()

Rolls back the current transaction, discarding all changes made within it.

open override fun rollback(savepoint: OctaviusSavepoint)

Rolls back the transaction to the state at the time the given savepoint was created.

Link copied to clipboard
open override fun setSavepoint(): OctaviusSavepoint

Creates an unnamed savepoint within the current transaction and returns it.

open override fun setSavepoint(name: String): OctaviusSavepoint

Creates a named savepoint within the current transaction and returns it.