Class UpdatingDataSource

java.lang.Object
org.dellroad.stuff.schema.AbstractUpdatingDataSource
org.dellroad.stuff.schema.UpdatingDataSource
All Implemented Interfaces:
Wrapper, CommonDataSource, DataSource

public class UpdatingDataSource extends AbstractUpdatingDataSource
A DataSource that wraps an inner DataSource and automatically applies a configured SQLCommandList on first access.
See Also:
  • Constructor Details

    • UpdatingDataSource

      public UpdatingDataSource()
  • Method Details

    • setSQLCommandList

      public void setSQLCommandList(SQLCommandList action)
      Configure the SQLCommandList to be applied to the database on first access. Required property.
      Parameters:
      action - SQL command(s) to apply exactly once to the underlying DataSource
    • setTransactional

      public void setTransactional(boolean transactional)
      Configure whether the SQLCommandList is applied transactionally or not. Default is true.
      Parameters:
      transactional - true for transactional application of SQL command(s)
    • updateDataSource

      protected void updateDataSource(DataSource dataSource) throws SQLException
      Description copied from class: AbstractUpdatingDataSource
      Update the inner DataSource.

      This method will be invoked at most once.

      Specified by:
      updateDataSource in class AbstractUpdatingDataSource
      Parameters:
      dataSource - the DataSource to update
      Throws:
      SQLException - if the update attempt fails