Как избежать ключевого слова Hibernate в Postgres?
Настройка hibernate/jpa и использование postgres 10 столбцов идентификации. У меня есть стол "user"
и другой "connector_config"
, Каждый с именем столбца id
с пометкой
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
и стол:
CREATE TABLE "connector_config"
(
id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
...
)
Таблицы должным образом экранированы, но последовательность становится дополнительной "
,
Проблема 1: Когда он пытается сделать выборку последовательности, он генерирует неправильный запрос с "
вокруг названия столбца id
,
Проблема 2: Насколько я понимаю, это не должно вызывать последовательности при использовании postgres 10, чтобы идентифицировать столбец и просто вставлять.
В моем application.yaml
файл у меня есть
spring:
jpa:
properties:
hibernate:
globally_quoted_identifiers: true
Вот что называется: select currval('"connector_config"_"id"_seq')
с трассировкой стека:
Caused by: org.postgresql.util.PSQLException: ERROR: invalid name syntax
Position: 16
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:143)
at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:106)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:60)
... 107 more
и вот что я ожидаю: select currval('"connector_config_id_seq"')
Версии: Hibernate:5.4.2 PostgresSql:42.2.5