Add SQL Server support to `JdbcSessionRepository`
Expected Behavior
JdbcSessionRepository works with Microsoft SQL Server, and JdbcSessionRepositoryDialect.from() detects it automatically, as it does for PostgreSQL, MySQL, MariaDB and H2.
Current Behavior
JdbcSessionRepositoryDialect.from() throws IllegalStateException for SQL Server, so session memory cannot be used on it. #7186 lists SQL Server among the dialects needed before chat memory is removed in 3.0.
Adding a dialect alone is not enough: JdbcSessionRepository builds two queries with LIMIT (the newest compaction boundary, and the last-N window in findEvents), and SQL Server has no LIMIT.
Context
I'd like to contribute this. Proposed change:
SqlServerJdbcSessionRepositoryDialectwith aMERGE-based upsert- a dialect method for the row-limit clause:
LIMIT ?by default,OFFSET 0 ROWS FETCH NEXT ? ROWS ONLYon SQL Server, which Oracle could reuse later schema-sqlserver.sql, detection of "Microsoft SQL Server" infrom(), and an integration test using the SQL Server Testcontainer
Happy to adjust the approach based on feedback.
Hi @durgadasepalli, thanks for opening this.
I'm interested in adding an Oracle dialect, which would need the same OFFSET ... FETCH limit clause you proposed here. Would it be okay if I follow up with Oracle once your PR lands, building on your change?
Hi @1o18z, sounds good.
I’ll keep the limit clause a dialect method so Oracle can reuse it as is, and I’ll ping you here once the PR is up.
@1o18z the PR is up: #7301.
JdbcSessionRepositoryDialect.getLimitClause() is the hook for Oracle.
Thanks @durgadasepalli! I'll start on Oracle once #7301 is merged.