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 TypeMethodDescriptionstatic JdbcSessionRepositoryDialectfrom(DataSource dataSource) The dialect of the database the data source connects to, from its product name: PostgreSQL, H2, MySQL or MariaDB.default StringInserts a row intoAI_SESSIONonly if its id does not exist, with the same four parameters asgetUpsertSessionSql(): one row updated on insert, zero rows or a duplicate-key error when the id exists.Inserts a row intoAI_SESSIONor updates the existing one, refreshing onlyexpires_atandmetadata:created_atkeeps its value andevent_versionis never touched.
-
Method Details
-
getUpsertSessionSql
String getUpsertSessionSql()Inserts a row intoAI_SESSIONor updates the existing one, refreshing onlyexpires_atandmetadata:created_atkeeps its value andevent_versionis never touched. Parameters, in order:id,created_at,expires_at,metadata. -
getInsertSessionIfAbsentSql
Inserts a row intoAI_SESSIONonly if its id does not exist, with the same four parameters asgetUpsertSessionSql(): one row updated on insert, zero rows or a duplicate-key error when the id exists. The default is a plainINSERT; a database whose failed statement aborts the enclosing transaction, PostgreSQL, uses a conflict-ignoring form. -
from
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 withJdbcSessionRepository.Builder.dialect(JdbcSessionRepositoryDialect)then
-