Interface IdGeneration


public interface IdGeneration
Describes how obtaining generated ids after an insert works for a given JDBC driver.
Since:
2.1
Author:
Jens Schauder, Chirag Tailor
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final IdGeneration
    A default instance working for many databases and equivalent to Spring Data JDBCs behavior before version 2.1.
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    Does the driver require the specification of those columns for which a generated id shall be returned.
    default String
    Provides for a given id SqlIdentifier the String that is to be used for registering interest in the generated value of that column.
    default boolean
    Does the driver support id generation for batch operations.
  • Field Details

    • DEFAULT

      static final IdGeneration DEFAULT
      A default instance working for many databases and equivalent to Spring Data JDBCs behavior before version 2.1.
  • Method Details

    • driverRequiresKeyColumnNames

      default boolean driverRequiresKeyColumnNames()
      Does the driver require the specification of those columns for which a generated id shall be returned.

      This should be false for most dialects. One notable exception is Oracle.

      Returns:
      true if the a list of column names should get passed to the JDBC driver for which ids shall be generated.
      See Also:
    • getKeyColumnName

      default String getKeyColumnName(SqlIdentifier id)
      Provides for a given id SqlIdentifier the String that is to be used for registering interest in the generated value of that column.
      Parameters:
      id - SqlIdentifier representing a column for which a generated value is to be obtained.
      Returns:
      a String representing that column in the way expected by the JDBC driver.
      Since:
      3.3
    • supportedForBatchOperations

      default boolean supportedForBatchOperations()
      Does the driver support id generation for batch operations.

      This should be true for most dialects, except DB2 and SqlServer.

      Returns:
      true if the JDBC driver supports generated keys for batch operations.
      Since:
      2.4
      See Also: