2

I updated version of com.h2database from 1.4.200 -> 2.0.202. and the version of liquibase is 4.3.5.

JDBC connection string looks like:

jdbc:h2:mem:database1;DB_CLOSE_DELAY=-1;MODE=Oracle;

And, I have a liquibase changeSet like this:

> databaseChangeLog:
>  - changeSet:
>      id:01
>      author:XYZ
>      changes:
>       - createTable:
>           columns:
>            - column:
>                autoIncrement:true
>                constraints:
>                  nullable: false
>                  primaryKey: true
>                  primaryKeyName: PK_table_employee
>                name: id
>                type: int
>            - column:
>                name: name
>                type: nvarchar(255)
>           tableName: table_employee

The given changeSet when executed creates "table-employee" in H2 (version 1.4.200), but the same changeSet gives an Error saying:

Error creating bean with name 'liquibase; defined in class path .....
Reason: liquibase.exception.DatabaseException: Syntax error in SQL statement "CREATE TABLE DBO.TBL_EMPLOYEE (ID INT AUTO_INCREMENT[*], NAME NVARCHAR(255))"

.....

I see "AUTO_INCREMENT" does not work in H2 (version 2.0.202).

Is there any workaround to resolve this issue ?

SSO
  • 21
  • 2

1 Answers1

0

In the default Regular mode H2 2.0 works like normal standard-compliant databases and rejects, for example, attempts to insert a NULL value into column with NOT NULL constraint, but Hibernate tries to do that, see issue HHH-14985.

Chaval
  • 1
  • 1
  • Sorry, may be I was not clear, actually I am facing issue during executing the above chagneset, which tries to create a table with "autoIncrement:true" for ID column. – SSO Dec 24 '21 at 21:50