Class BuiltinIdentityIdGenerator

java.lang.Object
org.seasar.doma.jdbc.id.AbstractIdGenerator
org.seasar.doma.jdbc.id.BuiltinIdentityIdGenerator
All Implemented Interfaces:
IdentityIdGenerator, IdGenerator

public class BuiltinIdentityIdGenerator extends AbstractIdGenerator implements IdentityIdGenerator
The built-in implementation for IdentityIdGenerator.
  • Constructor Details

    • BuiltinIdentityIdGenerator

      public BuiltinIdentityIdGenerator()
  • Method Details

    • supportsBatch

      public boolean supportsBatch(IdGenerationConfig config)
      Description copied from interface: IdGenerator
      Whether this generator supports the batch insert.
      Specified by:
      supportsBatch in interface IdGenerator
      Parameters:
      config - the configuration
      Returns:
      true if this generator supports
    • includesIdentityColumn

      public boolean includesIdentityColumn(IdGenerationConfig config)
      Description copied from interface: IdGenerator
      Whether this generator includes the identity column into SQL INSERT statements.
      Specified by:
      includesIdentityColumn in interface IdGenerator
      Parameters:
      config - the configuration
      Returns:
      true if supported
    • includesIdentityColumn

      public boolean includesIdentityColumn(IdGenerationConfig config, Object idValue)
      Description copied from interface: IdGenerator
      Determines whether the identity column is included in the SQL INSERT statements based on the given configuration and identity value.

      The type of idValue must be one of the basic types. It must never be a domain class or an Optional type that wraps a basic type.

      Specified by:
      includesIdentityColumn in interface IdGenerator
      Parameters:
      config - the configuration for identity generation
      idValue - an identity value; may be null
      Returns:
      true if the identity column is included in the SQL INSERT statements, otherwise false
    • supportsAutoGeneratedKeys

      public boolean supportsAutoGeneratedKeys(IdGenerationConfig config)
      Description copied from interface: IdGenerator
      Whether this generator supports Statement.getGeneratedKeys().
      Specified by:
      supportsAutoGeneratedKeys in interface IdGenerator
      Parameters:
      config - the configuration
      Returns:
      true if this generator supports
    • generatePreInsert

      public Long generatePreInsert(IdGenerationConfig config)
      Description copied from interface: IdGenerator
      Generates the identity value before an insert.
      Specified by:
      generatePreInsert in interface IdGenerator
      Parameters:
      config - the configuration
      Returns:
      the generated value or null if not supported
    • generatePostInsert

      public Long generatePostInsert(IdGenerationConfig config, Statement statement)
      Description copied from interface: IdGenerator
      Generates the identity value after an insert.
      Specified by:
      generatePostInsert in interface IdGenerator
      Parameters:
      config - the configuration
      statement - the SQL INSERT statement
      Returns:
      the generated value or null if not supported
    • getGeneratedValue

      protected long getGeneratedValue(IdGenerationConfig config, Statement statement)
      Retrieves the generated value by using Statement.getGeneratedKeys().
      Parameters:
      config - the configuration
      statement - the SQL INSERT statement
      Returns:
      the generated value
      Throws:
      JdbcException - if the generation is failed
    • getGeneratedValue

      protected long getGeneratedValue(IdGenerationConfig config)
      Retrieves the generated value by using a specific SQL.
      Parameters:
      config - the configuration
      Returns:
      the generated value
      Throws:
      JdbcException - if the generation is failed
    • generateValuesPostInsert

      public List<Long> generateValuesPostInsert(IdGenerationConfig config, Statement statement)
      Specified by:
      generateValuesPostInsert in interface IdGenerator
    • getGenerationType

      public GenerationType getGenerationType()
      Description copied from interface: IdGenerator
      Returns the generation type.
      Specified by:
      getGenerationType in interface IdGenerator
      Returns:
      the generation type