0

I am currently working on spring boot jpa applicaiton. it used to work normally with h2 1.4.196. After I upgrade to h2 to latest version(2.1.210). I am facing issues with the application.

I am facing issues with using reserved keywords in application. I have used key, value as fields in a class. I am able to solve this problem by using below statement.

spring.jpa.properties.hibernate.auto_quote_keyword = true,

above property puts quotes around the keywords which are used in application.

after using above property I am able to compile the application successfully, but while application is running I am facing issue with a field "language" that I used in application.

what I am guessing is, language is normally generated in liquibase generated database, but while querying, hibernate is putting "quotes" around language, thus producing a mismatch and giving error

Can someone please help to solve the issue.

Below is the generated sql from spring boot

Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Column "USER0_.language" not found; SQL statement: select user0_.id as id1_1_, user0_.dashboard_order as dashboar2_1_, user0_.date_format as date_for3_1_, user0_.user_email as user_ema4_1_, user0_."language" as language5_1_ from blu_dash_user user0_ where upper(user0_.user_email)=upper(?) [42122-210]

khasim
  • 11
  • 2
  • This kind of error is usually caused by the invalid quotation marks, as you noted above, but in this case, since LANGUAGE is a reserved word in some SQL versions, that's probably the source of the error. https://www.postgresql.org/docs/current/sql-keywords-appendix.html – tabbyfoo Jun 22 '22 at 20:48

1 Answers1

0

had same situation my manager found on stack overflow a solution, u can add in connection string list of key words to be permitted, example of connection string jdbc:h2:./test;NON_KEYWORDS=KEY,VALUE

hope will help folks

Guram Kankava
  • 51
  • 1
  • 4