Hi there,
during the migration of an application from MySQL to HSQLDB I am struggling with one data type mapping issue that I cannot seem to figure out a solution for. Effectively, during the creation of the SessionFactory Hibernate's schema validator complains about an inconsistent schema mapping:
Code:
org.hibernate.HibernateException: Wrong column type in <table> for column description. Found: varchar, expected: longvarchar
at org.hibernate.mapping.Table.validateColumns(Table.java:283)
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1343)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:139)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:378)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1872)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:855)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:774)
[...]
The problematic field is annotated as:
Code:
@Column(name = "description", nullable = true)
@Type(type="text")
This causes Hibernate to generate a longvarchar column, which HSQLDB apparently translates into a varchar(16M), which breaks the validation.
This happens with Hibernate 3.6.6 / HSDLDB 2.2.4 and the schema is generated using hibernate3-maven-plugin 2.2.
Any hints how to fix this issue are much appreciated. For now I will just disable validation, but it would still be interesting how to fix validation for HSQLDB.
Regards,
Thilo