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
- Alphabetic
- By Inheritance
- JdbcSession
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- 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
- 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
- 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
- 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
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])