
public.javadoc.org.spincast.plugins.jdbc.JdbcScope.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spincast-website Show documentation
Show all versions of spincast-website Show documentation
Source code for the https://www.spincast.org website.
JdbcScope (org.spincast:spincast-framework 2.1.1 API)
Package org.spincast.plugins.jdbc
Class JdbcScope
java.lang.Object
org.spincast.plugins.jdbc.JdbcScope
-
Field Summary
Fields
Modifier and Type
Field
Description
protected static final org.slf4j.Logger
protected static final ThreadLocal<Map<String,SpincastConnection>>
protected static final ThreadLocal<Map<String,Connection>>
-
Constructor Summary
Constructors
-
Method Summary
Modifier and Type
Method
Description
<T> T
autoCommit(DataSource dataSource,
JdbcQueries<T> queries)
Executes the queries
with a Connection
guaranteed to not be closed during the process.
getConnectionInterceptor(org.aopalliance.intercept.MethodInvocation invocation)
Gets a Connection from a DataSource, or from the ThreadLocal cache
if we're inside a transaction.
protected String
getDataSourceKey(DataSource dataSource)
protected SpincastConnectionFactory
boolean
<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...
<T> T
specificConnection(Connection connection,
DataSource dataSource,
JdbcQueries<T> queries)
Starts a scope where only the specified connection.
<T> T
transactional(DataSource dataSource,
JdbcQueries<T> queries)
Executes the queries
in a transaction
by setting the Connection#setAutoCommit()
property
to false
.
<T> T
transactional(TransactionalScope<T> scope)
Starts a transactional scope.
-
Field Details
-
logger
protected static final org.slf4j.Logger logger
-
spincastConnectionsThreadLocal
-
spincastSpecificConnectionsThreadLocal
-
Constructor Details
-
JdbcScope
-
Method Details
-
getSpincastConnectionFactory
-
getDataSourceKey
-
isInTransactionScope
public boolean isInTransactionScope()
-
autoCommit
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
Executes the queries
in a transaction
by setting the Connection#setAutoCommit()
property
to false
.
-
transactional
Starts a transactional scope.
-
getConnectionInterceptor
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()
.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy