Class AbstractIdGenerator

java.lang.Object
org.seasar.doma.jdbc.id.AbstractIdGenerator
All Implemented Interfaces:
IdGenerator
Direct Known Subclasses:
AbstractPreGenerateIdGenerator, BuiltinIdentityIdGenerator

public abstract class AbstractIdGenerator extends Object implements IdGenerator
A skeletal implementation of the IdGenerator interface.
  • Constructor Details

    • AbstractIdGenerator

      public AbstractIdGenerator()
  • Method Details

    • getGeneratedValue

      protected long getGeneratedValue(IdGenerationConfig config, Sql<?> sql)
      Executes the SQL and gets a generated identity.
      Parameters:
      config - the configuration for identity generation
      sql - the SQL to get the generated identityL
      Returns:
      the generated identity
      Throws:
      JdbcException - if a JDBC related error occurs
    • setupOptions

      protected void setupOptions(IdGenerationConfig config, PreparedStatement preparedStatement) throws SQLException
      Set up options for the preparedStatement object.
      Parameters:
      config - the configuration for identity generation
      preparedStatement - the prepared statement
      Throws:
      SQLException - if operations for the preparedStatement are failed
    • getGeneratedValue

      protected long getGeneratedValue(IdGenerationConfig config, ResultSet resultSet)
      Retrieves a generated identity from the ResultSet object.
      Parameters:
      config - the configuration for identity generation
      resultSet - the result set
      Returns:
      the generated identity
      Throws:
      JdbcException - if a JDBC related error occurs