Interface JdbcSessionRepositoryDialect

All Known Implementing Classes:
H2JdbcSessionRepositoryDialect, MysqlJdbcSessionRepositoryDialect, PostgresJdbcSessionRepositoryDialect

public interface JdbcSessionRepositoryDialect
The SQL that differs between databases, for JdbcSessionRepository: the upsert and the insert-if-absent of a session. Every other statement is shared and lives in the repository. from(DataSource) detects the dialect from the database metadata.
Since:
2.1.0
Author:
Christian Tzolov
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    from(DataSource dataSource)
    The dialect of the database the data source connects to, from its product name: PostgreSQL, H2, MySQL or MariaDB.
    default String
    Inserts a row into AI_SESSION only if its id does not exist, with the same four parameters as getUpsertSessionSql(): one row updated on insert, zero rows or a duplicate-key error when the id exists.
    Inserts a row into AI_SESSION or updates the existing one, refreshing only expires_at and metadata: created_at keeps its value and event_version is never touched.
  • Method Details

    • getUpsertSessionSql

      String getUpsertSessionSql()
      Inserts a row into AI_SESSION or updates the existing one, refreshing only expires_at and metadata: created_at keeps its value and event_version is never touched. Parameters, in order: id, created_at, expires_at, metadata.
    • getInsertSessionIfAbsentSql

      default String getInsertSessionIfAbsentSql()
      Inserts a row into AI_SESSION only if its id does not exist, with the same four parameters as getUpsertSessionSql(): one row updated on insert, zero rows or a duplicate-key error when the id exists. The default is a plain INSERT; a database whose failed statement aborts the enclosing transaction, PostgreSQL, uses a conflict-ignoring form.
    • from

      static JdbcSessionRepositoryDialect from(DataSource dataSource)
      The dialect of the database the data source connects to, from its product name: PostgreSQL, H2, MySQL or MariaDB.
      Throws:
      IllegalStateException - if the product name cannot be read or the database is not supported; set the dialect with JdbcSessionRepository.Builder.dialect(JdbcSessionRepositoryDialect) then