Validator does not agree with Hibernate Tools Reverse Engineering


#1

Hi there!

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


Hibernate Tools Reverse Engineering does not agree with Validator
#2

@Koen_Aers I categorized it as Hibernate Tools for now, could you take a look if it’s an Hibernate Tools issue?

If it’s an ORM one, I’ll move it to ORM. Thanks.


#3

Not sure, that’s why I cross posted the link on that topic too with a link to this one:

I think it may actually be the validator not understanding the semantics of MySQL > 5.5 or not using the dialect or something along those lines. I think the hibernate tools mapping and the annotation is actually correct.

In any case, one of the two sides is not in agreement with the other for some reason.

I can’t believe I am the only person trying to get this to work, so I am guessing I am missing something very obvious such as something that appears to be new like hibernate.dialect.storage_engine = innodb and deprecation of the xxxInnoDB dialects but I am not entirely sure.


#4

So do you guys have any idea what is going on or what am I missing?

Shouldn’t these two sides be in agreement ? I am guessing that I am missing something very obvious because this should just work without much tinkering.

Thanks,
Alex


#5

Hey @aimass,

Can you detail the table definition? It would help if you create a scaled down test case that shows the issue.

Cheers,
Koen