Class JdbcScope

java.lang.Object
org.spincast.plugins.jdbc.JdbcScope

public class JdbcScope extends Object
  • Field Details

  • Constructor Details

  • Method Details

    • getSpincastConnectionFactory

      protected SpincastConnectionFactory getSpincastConnectionFactory()
    • getDataSourceKey

      protected String getDataSourceKey(DataSource dataSource)
    • isInTransactionScope

      public boolean isInTransactionScope()
    • autoCommit

      public <T> T autoCommit(DataSource dataSource, JdbcQueries<T> queries)
      Executes the queries with a Connection guaranteed to not be closed during the process. At the end of the process, the Connection will be closed automatically.

      Each query is going to be commited on the fly. Use transactional(DataSource, JdbcQueries) or a transactional(TransactionalScope) scope instead if you need transactional support.

    • specificConnection

      public <T> T specificConnection(Connection connection, DataSource dataSource, ConnectionScope<T> connectionScope)
      Starts a scope where only the specified connection will be used (as long as autoCommit(), transactional(), transactional(), withSpecificConnection() or withSpecificConnection() are used... Not a connection taken directly from a DataSource.)
    • specificConnection

      public <T> T specificConnection(Connection connection, DataSource dataSource, JdbcQueries<T> queries)
      Starts a scope where only the specified connection. will be used (as long as autoCommit(), transactional(), transactional(), withSpecificConnection() or withSpecificConnection() are used... Not a connection taken directly from a DataSource.)
    • transactional

      public <T> T transactional(DataSource dataSource, JdbcQueries<T> queries)
      Executes the queries in a transaction by setting the Connection#setAutoCommit() property to false.
    • transactional

      public <T> T transactional(TransactionalScope<T> scope)
      Starts a transactional scope.
    • getConnectionInterceptor

      public Connection getConnectionInterceptor(org.aopalliance.intercept.MethodInvocation invocation)
      Gets a Connection from a DataSource, or from the ThreadLocal cache if we're inside a transaction. This method is called by AOP intercepting DataSource.getConnection().