'Hibernate not respecting column length attributes when creating uniqueness constraint

I have a simple properties tag creating a uniqueness constraint.

<properties name="uniqueness_constraint" unique="true" update="true"> 
    <property name="name" not-null="true" column="name" length="100"/>
    <property name="address" not-null="true" column="address" length="20"/> 
    <property name="zip" not-null="true" column="zip" length="5"/>
</properties> 

When I build my database and SHOW CREATE, the uniqueness constraint exists without length enforcement.

 UNIQUE KEY `UK_1m68hog44v16j9x6ff5xrj7c5` (`name`,`address`,`zip`)

and not

UNIQUE KEY `UK_1m68hog44v16j9x6ff5xrj7c5` (`name(100)`,`address(20)`,`zip(5)`)

Running an alter-table SQL statement and adding the constraint like that gives me no problem, but I want to define it in Hibernate XML. Any thoughts?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source