Upgraded H2 from 1.4.200 to 2.0.206 and now in my integration tests I'm getting a 42001 Syntax error in SQL statement (JdbcSQLSyntaxErrorException) around this select: attributes0_.value[*] as value3_8_1_
I'm using hibernate entities. Also, using H2 only in a test environment.
I tried:
- setting the
H2Dialectin the testyamlfile - logging the SQL statements to see if there's anything suspicious, with no luck
CodePudding user response:
The problem was I had an entity (hibernate) field name equal to a reserved word: value; that's why the stacktrace pointed it out with an asterix ([*]). A full list of keywords/reserved words can be found here.
This answer solved my issue, and I'm reposting here for the sake of people searching "h2 upgrade sql error"
Since it's a test environment, I made the quick fix of setting globally_quoted_identifiers: true in my test YAML file.
For production environments, make sure you either:
- set the globally quoted identifiers, like I did
- set h2 non keywords
- read up on h2's compatibility feature
or a combination of these.
