Using:
- Hibernate Tools 5.2.x (tried 5.2.0.Final and 5.2.9.Final)
- Hibernate Core-5.2.13.Final.
- Dialect: org.hibernate.dialect.MySQL57Dialect
- Spring 5, Spring Boot 2, Gradle
Hibernate tools hbm2java generates this:
@Column(name="domain", nullable=false, length=65535)
public String getDomain() {
return this.domain;
}
But validator complains about this:
wrong column type encountered in column [domain] in table [tpd.acl_object];
found [text (Types#LONGVARCHAR)],
but expecting [varchar(65535) (Types#VARCHAR)]
Detail:
Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Schema
validation: wrong column type encountered in column [domain] in table
[tpd.acl_object];
found [text (Types#LONGVARCHAR)],
but expecting [varchar(65535) (Types#VARCHAR)]
at org.hibernate.tool.schema.internal.AbstractSchemaValidator.validateColumnType(AbstractSchemaValidator.java:159)*
So what gives? Why is the validator not in agreement with Hibernate Tools?
Some solutions say to add columnDefinition=“TEXT”
to the get annotation but that cannot be done neither by type mapping nor custom templates. Also, not sure this is a good idea (i.e. to expose the SQL Type up the food chain). So I am guessing the solution is much simpler and I am missing something very obvious because I cannot be the only person using this combination.
Thanks! Alex