Class BulkLoadingDaoSupport
java.lang.Object
net.solarnetwork.central.common.dao.jdbc.BulkLoadingDaoSupport
Helper class for
BulkLoadingDao
implementations that uses a JDBC prepared statement for bulk loading
operations.
To use this class, create an instance and configure the DataSource,
PlatformTransactionManager, and jdbcCall to use, which can be
a simple prepared statement or a callable statement. Then create a subclass
of BulkLoadingDaoSupport.BulkLoadingContext and implement the
doLoad(T, PreparedStatement, long) method to set the prepared
statement parameters and execute the update for each entity to be loaded.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassBulkLoadingDaoSupport.BulkLoadingContext<T extends net.solarnetwork.dao.Entity<PK>,PK extends Serializable> Abstract implementation of a bulk loading context. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the JDBC data source.Get the JDBC statement to use for bulk loading.org.springframework.transaction.PlatformTransactionManagerGet the transaction manager.voidsetDataSource(DataSource dataSource) Set the JDBC data source.voidsetJdbcCall(String jdbcCall) Set the JDBC statement to use for bulk loading.voidsetTransactionManager(org.springframework.transaction.PlatformTransactionManager txManager) Set the transaction manager.
-
Field Details
-
DEFAULT_BATCH_SIZE
public static final int DEFAULT_BATCH_SIZEThe default batch size.- See Also:
-
-
Constructor Details
-
BulkLoadingDaoSupport
public BulkLoadingDaoSupport(org.slf4j.Logger log) Constructor.- Parameters:
log- the logger to use
-
-
Method Details
-
getTransactionManager
public org.springframework.transaction.PlatformTransactionManager getTransactionManager()Get the transaction manager.- Returns:
- the manager
-
setTransactionManager
public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager txManager) Set the transaction manager.- Parameters:
txManager- the manager to set
-
getDataSource
Get the JDBC data source.- Returns:
- the dataSource
-
setDataSource
Set the JDBC data source.- Parameters:
dataSource- the dataSource to set
-
getJdbcCall
Get the JDBC statement to use for bulk loading.- Returns:
- the JDBC statement
-
setJdbcCall
Set the JDBC statement to use for bulk loading.- Parameters:
jdbcCall- the JDBC statement to set
-