public class DataSourceXAConnectionFactory extends java.lang.Object implements XAConnectionFactory
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
password |
protected TransactionRegistry |
transactionRegistry |
protected java.lang.String |
username |
protected javax.sql.XADataSource |
xaDataSource |
Constructor and Description |
---|
DataSourceXAConnectionFactory(javax.transaction.TransactionManager transactionManager,
javax.sql.XADataSource xaDataSource)
Creates an DataSourceXAConnectionFactory which uses the specified XADataSource to create database
connections.
|
DataSourceXAConnectionFactory(javax.transaction.TransactionManager transactionManager,
javax.sql.XADataSource xaDataSource,
java.lang.String username,
java.lang.String password)
Creates an DataSourceXAConnectionFactory which uses the specified XADataSource to create database
connections.
|
Modifier and Type | Method and Description |
---|---|
java.sql.Connection |
createConnection()
Create a new
Connection in an implementation specific fashion. |
TransactionRegistry |
getTransactionRegistry()
Gets the TransactionRegistry for this connection factory which contains a the
XAResource for every connection created by this factory.
|
java.lang.String |
getUsername()
Gets the username used to authenticate new connections.
|
void |
setPassword(java.lang.String password)
Sets the password used to authenticate new connections.
|
void |
setUsername(java.lang.String username)
Sets the username used to authenticate new connections.
|
protected TransactionRegistry transactionRegistry
protected javax.sql.XADataSource xaDataSource
protected java.lang.String username
protected java.lang.String password
public DataSourceXAConnectionFactory(javax.transaction.TransactionManager transactionManager, javax.sql.XADataSource xaDataSource)
transactionManager
- the transaction manager in which connections will be enlistedxaDataSource
- the data source from which connections will be retrievedpublic DataSourceXAConnectionFactory(javax.transaction.TransactionManager transactionManager, javax.sql.XADataSource xaDataSource, java.lang.String username, java.lang.String password)
transactionManager
- the transaction manager in which connections will be enlistedxaDataSource
- the data source from which connections will be retrievedusername
- the username used for authenticating new connections or null for unauthenticatedpassword
- the password used for authenticating new connectionspublic java.lang.String getUsername()
public void setUsername(java.lang.String username)
username
- the username used for authenticating the connection or null for unauthenticatedpublic void setPassword(java.lang.String password)
password
- the password used for authenticating the connection or null for unauthenticatedpublic TransactionRegistry getTransactionRegistry()
XAConnectionFactory
getTransactionRegistry
in interface XAConnectionFactory
public java.sql.Connection createConnection() throws java.sql.SQLException
XAConnectionFactory
Connection
in an implementation specific fashion.
An implementation can assume that the caller of this will wrap the connection in
a proxy that protects access to the setAutoCommit, commit and rollback when
enrolled in a XA transaction.createConnection
in interface ConnectionFactory
createConnection
in interface XAConnectionFactory
Connection
java.sql.SQLException
- if a database error occurs creating the connection