Packages

t

akka.projection.jdbc

JdbcSession

trait JdbcSession extends AnyRef

Generic interface to give access to basic JDBC connection operations.

A new JdbcSession will be created for each call to the projection handler. Upon creation a database connection must be created (preferably relying on connection pool) and used through out the live of this instance.

After usage, the underlying database connection will be closed (returned to the pool) after committing or rolling back the transaction. It's paramount to configure the connection to NOT use auto-commit in order to guarantee that the event handling and offset persistence operations participate on the same transaction.

The only requirement to implement a JdbcSession is to have access to the underlying JDBC Connection. When using plain JDBC, one can initialize a connection directly, but when relying on a JDBC framework like JPA it will depend on the chosen implementation. Hibernate for instance provides indirect access to the underlying connection through a lambda call and therefore can be used (see JdbcSession#withConnection method). Other JPA implementations may not provide this feature.

Source
JdbcSession.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. JdbcSession
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def close(): Unit

    Closes the connection after use.

    Closes the connection after use. Should delegate to Connection#close() or equivalent depending on underlying JDBC framework.

    Annotations
    @throws(classOf[SQLException])
    Exceptions thrown
  2. abstract def commit(): Unit

    Commits the transaction after processing.

    Commits the transaction after processing. Should delegate to Connection#commit() or equivalent depending on underlying JDBC framework.

    Annotations
    @throws(classOf[SQLException])
    Exceptions thrown
  3. abstract def rollback(): Unit

    Rollback the transaction in case of failures.

    Rollback the transaction in case of failures. Should delegate to Connection#rollback() or equivalent depending on underlying JDBC framework.

    Annotations
    @throws(classOf[SQLException])
    Exceptions thrown
  4. abstract def withConnection[Result](func: Function[Connection, Result]): Result

    This method provides access to the underlying connection through a lambda call.

    This method provides access to the underlying connection through a lambda call. Implementors should ensure that every single call to this method instance uses the same JDBC connection instance.

    For plain JDBC implementations an instance of the open connection should be kept as internal state and passed to the lambda call. For implementations based on Hibernate, this method can be rely on Hibernate's Session.doReturningWork.

    Annotations
    @throws(classOf[Exception])

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  9. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  13. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  14. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  15. def toString(): String
    Definition Classes
    AnyRef → Any
  16. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  17. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  18. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from AnyRef

Inherited from Any

Ungrouped