I’m trying to convert an existing application to use liquibase. The approach is to generate the DB with hibernate annotations and then generate a liquibase changelog.xml from the DB. All new instances of the app will use liquibase and the newly generated changelog.xml to generate the DB on a new install instead of using hibernate.
Liquibase is throwing an exception on the creation of one of the columns in a table. The column is declared in java as a BigDecimal. That gets translated into an hsqldb NUMERIC(31,3) by hibernate. The liquibase generateChangeLog produces a NUMERIC(31,3) type for the column definition. When trying to use this changelog.xml to generate the DB with liquibase, liquibase throws an exception: java.sql.SQLSyntaxErrorException: type not found or user lacks privilege: NUMBER.
Interesting that liquibase is referring to the NUMERIC column as a NUMBER.
Tried changing the NUMERIC(31,3) to DECIMAL(31,3) in the changelog.xml. luiquibase created the column and table with an hsqldb DECIMAL type, but then hibernate throws an exception when it tries to validate the DB.
Please advise. Thanks.
Here are the details of what happens:
java 1.7hsqldb 2.2.8
hibernate 4.1.1
liquibase 2.0.5
Java code uses BigDecimal data type:
@Nullable @Override public BigDecimal getNumericValue() {…}
DB and table is created by hibernate with NUMERIC data type as the column data type:
COLUMN_NAME
Application is run again with a new empty DB instance using luiqibase to manage the DB with the changelog just created.
All other tables are created correctly by liquibase. The table with the NUMERIC(31,3) column throws an exception:
SEVERE 10/22/12 4:25 PM:liquibase: Error executing SQL CREATE TABLE EC_PROPERTY (PROPERTY_TYPE VARCHAR(31) NOT NULL, ID BIGINT NOT NULL, VERSION BIGINT NOT NULL, NAME VARCHAR(255) NOT NULL, CREATED DATETIME NOT NULL, CREATED_MILLIS BIGINT NOT NULL, DELETED TINYINT, LAST_MODIFIED_BY VARCHAR(255), MODIFIED DATETIME NOT NULL, MODIFIED_MILLIS BIGINT NOT NULL, OWNER VARCHAR(255), DESCRIPTION VARCHAR(450), STRING VARCHAR(450), EXPANDABLE BOOLEAN, NUMERIC_VALUE NUMBER(31,3), DESCRIPTION_CLOB_ID BIGINT, PARENT_SHEET_ID BIGINT NOT NULL, PATH_ID BIGINT, PROPERTY_SHEET_ID BIGINT, CLOB_ID BIGINT, CONSTRAINT SYS_PK_10377 PRIMARY KEY (ID))
java.sql.SQLSyntaxErrorException: type not found or user lacks privilege: NUMBER