Class BulkLoadingDaoSupport

java.lang.Object
net.solarnetwork.central.common.dao.jdbc.BulkLoadingDaoSupport

public class BulkLoadingDaoSupport extends Object
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.

  • Field Details

    • DEFAULT_BATCH_SIZE

      public static final int DEFAULT_BATCH_SIZE
      The 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

      public DataSource getDataSource()
      Get the JDBC data source.
      Returns:
      the dataSource
    • setDataSource

      public void setDataSource(DataSource dataSource)
      Set the JDBC data source.
      Parameters:
      dataSource - the dataSource to set
    • getJdbcCall

      public String getJdbcCall()
      Get the JDBC statement to use for bulk loading.
      Returns:
      the JDBC statement
    • setJdbcCall

      public void setJdbcCall(String jdbcCall)
      Set the JDBC statement to use for bulk loading.
      Parameters:
      jdbcCall - the JDBC statement to set