Akin_Glen
Akin_Glen

Reputation: 767

hibernate version property mapping in reverse engineering file

I'm working on application that uses 66 tables (SQL Server 2012). Already, hibernate refuses to recognise the "identity" property set for each id column, so I have to put in the <table> element below in my reverse engineering to fix that, just in case I have to re-map my table after making changes to them in SQL Server 2012:

<table name="EMPLOYEE">
      <primary-key>
          <generator class="identity"/>
      </primary-key>
  </table>

The question is, I want to do the same for the version property without having to go into all 66 hbm.xml files to add <version name=”version” type=”long” /> every time I map my tables.

Is there a way to set something in the reverse engineering or somewhere else so that hibernate automatically adds the version property?

Thanks

Upvotes: 0

Views: 574

Answers (1)

Akin_Glen
Akin_Glen

Reputation: 767

Figured this out. The answer is to ensure that your versioning column in your db is called "version" and hibernate will automatically set the versioning in the xml mapping for you.

Upvotes: 1

Related Questions