Wrong column type in tablename for column label_id. Found: varbinary, expected: binary(16)
I have specified a UUID field as an @Id column with @Column(name = "label_id", nullable = false, columnDefinition = "binary(16)" )
The table is created properly with a binary(16) but when validating it seems varbinary is returned. Which causes the message to popup.
H2 uses varbinary for everything. Even when binary(16) is specified during creation of table the meta data request on the column returns varbinary.
The workaround I used to get it working was creating a new H2Dialect class extending org.hibernate.dialect.H2Dialect
In the constructor of the new H2Dialect overrule: registerColumnType( Types.BINARY, "varbinary" );
This is the workaround for me.
TRACE: Caused by: org.hibernate.HibernateException: Wrong column type in TEST3590876896783704391.DB.PUBLIC.PRODUCT_LABEL_PRICE_HIST for column label_id. Found: varbinary, expected: binary(16) at org.hibernate.mapping.Table.validateColumns(Table.java:373) ~[hibernate-core-4.3.10.Final.jar:4.3.10.Final] at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1338) ~[hibernate-core-4.3.10.Final.jar:4.3.10.Final] at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:175) ~[hibernate-core-4.3.10.Final.jar:4.3.10.Final] at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:525) ~[hibernate-core-4.3.10.Final.jar:4.3.10.Final] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1859) ~[hibernate-core-4.3.10.Final.jar:4.3.10.Final] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:857) ~[hibernate-entitymanager-4.3.10.Final.jar:4.3.10.Final] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850) ~[hibernate-entitymanager-4.3.10.Final.jar:4.3.10.Final] at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:425) ~[hibernate-core-4.3.10.Final.jar:4.3.10.Final] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:849) ~[hibernate-entitymanager-4.3.10.Final.jar:4.3.10.Final]
|