public class DatabaseDataSourceConnectionFactoryBean extends Object implements org.springframework.beans.factory.FactoryBean<org.dbunit.database.DatabaseDataSourceConnection>
FactoryBean
that can be used to create a transaction
aware
DatabaseDataSourceConnection
using the specified dataSource
. Additional configuration
is also supported using setDatabaseConfig(DatabaseConfigBean)
.Constructor and Description |
---|
DatabaseDataSourceConnectionFactoryBean() |
DatabaseDataSourceConnectionFactoryBean(DataSource dataSource) |
Modifier and Type | Method and Description |
---|---|
org.dbunit.database.DatabaseDataSourceConnection |
getObject() |
Class<?> |
getObjectType() |
boolean |
isSingleton() |
static org.dbunit.database.IDatabaseConnection |
newConnection(DataSource dataSource)
Convenience method that can be used to construct a transaction aware
IDatabaseConnection from a
DataSource . |
void |
setDatabaseConfig(DatabaseConfigBean databaseConfig)
Set an optional
configuration that will be applied to the newly created
DatabaseDataSourceConnection |
void |
setDataSource(DataSource dataSource)
Set the data source that will be used for the
DatabaseDataSourceConnection . |
void |
setPassword(String password)
Set the password to use when accessing the data source.
|
void |
setSchema(String schema)
Set the schema to use when accessing the data source.
|
void |
setTransactionAware(boolean transactionAware)
Determines if the
IDatabaseConnection created by this bean should be aware of Spring
PlatformTransactionManager s. |
void |
setUsername(String username)
Set the user name to use when accessing the data source.
|
public DatabaseDataSourceConnectionFactoryBean()
public DatabaseDataSourceConnectionFactoryBean(DataSource dataSource)
public org.dbunit.database.DatabaseDataSourceConnection getObject() throws Exception
getObject
in interface org.springframework.beans.factory.FactoryBean<org.dbunit.database.DatabaseDataSourceConnection>
Exception
public Class<?> getObjectType()
getObjectType
in interface org.springframework.beans.factory.FactoryBean<org.dbunit.database.DatabaseDataSourceConnection>
public boolean isSingleton()
isSingleton
in interface org.springframework.beans.factory.FactoryBean<org.dbunit.database.DatabaseDataSourceConnection>
public void setDataSource(DataSource dataSource)
DatabaseDataSourceConnection
. This value must be set before
the connection can be created.dataSource
- the data sourcepublic void setUsername(String username)
username
- the user name or nullpublic void setPassword(String password)
password
- the password or nullpublic void setSchema(String schema)
schema
- the schema or nullpublic void setDatabaseConfig(DatabaseConfigBean databaseConfig)
configuration
that will be applied to the newly created
DatabaseDataSourceConnection
databaseConfig
- the database configuration or null if no additional configuration is required.public void setTransactionAware(boolean transactionAware)
IDatabaseConnection
created by this bean should be aware of Spring
PlatformTransactionManager
s. Defaults to truetransactionAware
- If the connection should be transaction awarepublic static org.dbunit.database.IDatabaseConnection newConnection(DataSource dataSource)
IDatabaseConnection
from a
DataSource
.dataSource
- The data sourceIDatabaseConnection
Copyright © 2016. All rights reserved.