package jdbc
Type Members
- trait JdbcHandlerLifecycle extends AnyRef
- trait JdbcSession extends AnyRef
Generic interface to give access to basic JDBC connection operations.
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.