StefanSchubert / sabi

Seawater Aquarium Business Intelligence (sabi) aims to gain knowledge from aquarists for aquarists based on collected seawater parameters.
https://sabi-project.net
MIT License
4 stars 3 forks source link

Upgrade com.h2database:h2 to version 2.0.206 or later. (Incompatible to v1.x - Migration required) #106

Closed StefanSchubert closed 2 years ago

StefanSchubert commented 2 years ago

Describe the bug It's not really a bug but a migration effort which is required due to security issues which does not really apply in sabis context, as we are using the h2 only for testing but the dependabot security advices I see as repo owner is just ugyl.

To Reproduce Steps to reproduce the behavior:

  1. Checkout the repository
  2. Do a mvn install on sabi-boundary module (required to build the sabi-server)
  3. Do a mvn test on the sabi-server module and see that all tests have been past successful.
  4. Open pom.xml of this module and change com.h2database dependency version from 1.4.196 to 2.0.206 or later
  5. repeat the mvn test...you will see test failures now, as the h2 contract seems broken.

Expected behavior Same tests as before should work with the new h2 version

StefanSchubert commented 2 years ago

See also: https://www.h2database.com/html/migration-to-v2.html

StefanSchubert commented 2 years ago

Observed Error in log while trying wit v2:

[EL Warning]: 2022-01-16 10:56:24.977--ServerSession(1226784688)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.9.v20210604-2c549e2208): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.h2.jdbc.JdbcSQLSyntaxErrorException: 
Syntax error in SQL statement "CREATE TABLE AQUARIUM (ID BIGINT IDENTITY[*] NOT NULL, ACTIVE BOOLEAN NOT NULL, CREATED_ON TIMESTAMP NOT NULL, DESCRIPTION VARCHAR(255) NOT NULL, INCEPTION_DATE DATE, LASTMOD_ON TIMESTAMP, OPTLOCK INTEGER DEFAULT 0, SIZE INTEGER, SIZE_UNIT VARCHAR(10), USER_ID BIGINT NOT NULL, PRIMARY KEY (ID))"; expected "ARRAY, INVISIBLE, VISIBLE, NOT, NULL, AS, DEFAULT, GENERATED, ON, NOT, NULL, AUTO_INCREMENT, DEFAULT, NULL_TO_DEFAULT, SEQUENCE, SELECTIVITY, COMMENT, CONSTRAINT, COMMENT, PRIMARY, UNIQUE, NOT, NULL, CHECK, REFERENCES, AUTO_INCREMENT, ., )"; SQL statement:
CREATE TABLE aquarium (id BIGINT IDENTITY NOT NULL, active BOOLEAN NOT NULL, created_on TIMESTAMP NOT NULL, description VARCHAR(255) NOT NULL, inception_date DATE, lastmod_on TIMESTAMP, optlock integer DEFAULT 0, size INTEGER, size_unit VARCHAR(10), user_id BIGINT NOT NULL, PRIMARY KEY (id)) [42001-206]
Error Code: 42001

It looks like H2 v2 has a problem with the IDENTITY column (see [*] marker).

StefanSchubert commented 2 years ago

Might be resolved with 2.0.210 see: https://groups.google.com/g/h2-database/c/RH06az2F75w