I have an entity called User
which leads to a table called user
which in PostgreSQL should be surrounded with quotes for it to work. I know I can specify a custom table name, but shouldn't Hibernate do the quotes automatically?
I was told that maybe Hibernate is not using the PostgreSQL dialect. Is that possible when my database is configured like this:
spring.datasource.url = jdbc:postgresql://localhost/database_name
spring.datasource.username = username
spring.datasource.password = password
and if that's the case, how do I make Hibernate use the correct dialect?
I tried:
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
and
spring.jpa.database=postgresql
and
spring.jpa.database-platform = org.hibernate.dialect.PostgreSQL94Dialect
and
spring.jpa.database=org.hibernate.dialect.PostgreSQLDialect
having no effect on the error:
Hibernate: insert into user (created_at, last_modified_at, account_id, email, hashed_password_salt, name, over_hashed_password, preferred_name, public_key, started_displaying_sites_at, watched_tutorial_at, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2017-09-08 14:41:40.177 WARN 15764 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 0, SQLState: 42601
2017-09-08 14:41:40.177 ERROR 15764 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : ERROR: syntax error at or near "user"
Position: 13