Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

426
Views
Spring Session with JDBC - how do I specify the schema for the session tables

I am using Spring Session with Postgres to store user sessions for a spring boot app. Spring Session is looking for the spring_session and spring_session_attributes tables in the public schema. Is there a way to tell Spring Session to look for the session tables in a schema other than public? spring.jpa.properties.hibernate.default_schema in application.properties seems to have no affect on this.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

I managed to solve the problem by specifying the schema in the connect string/datasource URL as follows (also as described in an answer here):

spring.datasource.url=jdbc:postgresql://localhost:9999/db_name?currentSchema=<schema_name>

Still not sure why the spring.session.jdbc.schema property in application.properties has no affect on the schema used by spring session...

over 4 years ago · Santiago Trujillo Report

0

Actually the parameter spring.session.jdbc.schema does not means the "database schema", but the SQL schema (the SQL that defines the data structure where the session data is stored).

The schemas for different DBs are available at:

https://github.com/spring-projects/spring-session/tree/master/spring-session-jdbc/src/main/resources/org/springframework/session/jdbc

over 4 years ago · Santiago Trujillo Report

0

You can set the table name to be used by Spring Session in your application.properties like this:

spring.session.jdbc.table-name = MY_SCHEMA.SPRING_SESSION

As a result the SQL queries issued by Spring Session will go against the tables of your specified schema. See also org.springframework.session.jdbc.JdbcOperationsSessionRepository.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!