java.lang.Object
org.seasar.doma.jdbc.tx.LocalTransactionDataSource
- All Implemented Interfaces:
Wrapper,CommonDataSource,DataSource
A data source for local transactions.
This instance is thread safe.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionLocalTransactionDataSource(String url, String user, String password) Creates an instance with information about the connection.LocalTransactionDataSource(DataSource dataSource) Creates an instance. -
Method Summary
Modifier and TypeMethodDescriptionReturns a connection.getConnection(String username, String password) Returns a connection.getKeepAliveLocalTransaction(JdbcLogger jdbcLogger) Returns a keep alive local transaction.getKeepAliveLocalTransaction(JdbcLogger jdbcLogger, TransactionIsolationLevel transactionIsolationLevel) Returns a keep alive local transaction with the specified transaction level.getLocalTransaction(JdbcLogger jdbcLogger) Returns a local transaction.getLocalTransaction(JdbcLogger jdbcLogger, TransactionIsolationLevel transactionIsolationLevel) Returns a local transaction with the specified transaction level.intbooleanisWrapperFor(Class<?> iface) voidsetLoginTimeout(int seconds) voidsetLogWriter(PrintWriter out) <T> TMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.sql.CommonDataSource
createShardingKeyBuilderMethods inherited from interface javax.sql.DataSource
createConnectionBuilder
-
Constructor Details
-
LocalTransactionDataSource
Creates an instance.- Parameters:
dataSource- the internal data source- Throws:
DomaNullPointerException- if thedataSourceisnull
-
LocalTransactionDataSource
Creates an instance with information about the connection.- Parameters:
url- a database urluser- the database userpassword- the user's password- Throws:
DomaNullPointerException- if theurlisnull
-
-
Method Details
-
getConnection
Returns a connection.If a transaction has started, it returns the connection under transaction management; if not, it returns the connection provided by the internal data source.
- Specified by:
getConnectionin interfaceDataSource- Returns:
- the connection
- See Also:
-
getConnection
Returns a connection.If a transaction has started, it returns the connection under transaction management; if not, it returns the connection provided by the internal data source.
- Specified by:
getConnectionin interfaceDataSource- Returns:
- the connection
- See Also:
-
getLoginTimeout
- Specified by:
getLoginTimeoutin interfaceCommonDataSource- Specified by:
getLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
getLogWriter
- Specified by:
getLogWriterin interfaceCommonDataSource- Specified by:
getLogWriterin interfaceDataSource- Throws:
SQLException
-
isWrapperFor
- Specified by:
isWrapperForin interfaceWrapper- Throws:
SQLException
-
setLoginTimeout
- Specified by:
setLoginTimeoutin interfaceCommonDataSource- Specified by:
setLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
setLogWriter
- Specified by:
setLogWriterin interfaceCommonDataSource- Specified by:
setLogWriterin interfaceDataSource- Throws:
SQLException
-
unwrap
- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
getLocalTransaction
Returns a local transaction.- Parameters:
jdbcLogger- the logger- Returns:
- the transaction
- Throws:
DomaNullPointerException- if thejdbcLoggerisnull
-
getLocalTransaction
public LocalTransaction getLocalTransaction(JdbcLogger jdbcLogger, TransactionIsolationLevel transactionIsolationLevel) Returns a local transaction with the specified transaction level.- Parameters:
jdbcLogger- the loggertransactionIsolationLevel- the transaction isolation level- Returns:
- the transaction
- Throws:
DomaNullPointerException- if any arguments arenull
-
getKeepAliveLocalTransaction
Returns a keep alive local transaction.- Parameters:
jdbcLogger- the logger- Returns:
- the transaction
- Throws:
DomaNullPointerException- if thejdbcLoggerisnull
-
getKeepAliveLocalTransaction
public KeepAliveLocalTransaction getKeepAliveLocalTransaction(JdbcLogger jdbcLogger, TransactionIsolationLevel transactionIsolationLevel) Returns a keep alive local transaction with the specified transaction level.- Parameters:
jdbcLogger- the loggertransactionIsolationLevel- the isolation level- Returns:
- the transaction
- Throws:
DomaNullPointerException- if any arguments arenull
-
getParentLogger
- Specified by:
getParentLoggerin interfaceCommonDataSource- Throws:
SQLFeatureNotSupportedException
-