Friday, March 14, 2008

Hibernate Tools Version Field Mapping

Been using Hibernate tools (HibernateTools-3.2.0.GA) to create some domain classes and mappings out of my existing DB, basically doing some reverse engineering. I came across a bug that I think I should point out.

If the tool encounters a field name VERSION in any table it will not generate a property mapping but a version (tag see below).

<version name="version" type="big_decimal">
<column name="VERSION" precision="22" scale="0"/>
</version>

when it should be

<property name="version" type="big_decimal">
<column name="VERSION" precision="22" scale="0"/>
</property>

Guess you'll have to modify the hbm.xml files manually.

1 comment:

Anonymous said...

Had the same problem. I spent valuable time to find the cause. The generated .java files are ok.