I have this property mapping:
<property name="name" lazy="false" insert="true" update="true" not-null="true" unique="true" type="java.lang.String">
<column not-null="true" unique="true" name="`name`"/>
</property>
Note the unique="true" and the backticked column name. When creating the db schema hibernate executes this sql statement to create the unique constraint, this fails:
alter table `mandatoryfields` add constraint `name`_ unique (`name`)
The reason it fails is that the postfix (_, the underscore) is placed outside of the backticked name. This statement works fine:
alter table `mandatoryfields` add constraint `name_` unique (`name`);
This error seems to have been introduced after hb 4.1.8 (but not sure...) At least it appears going from 3.6 to 4.1.10.
|