Joined: Thu Feb 26, 2004 6:42 am Posts: 3 Location: Stockholm, Sweden
|
Hi folks,
I am faced with this problem:
I have a database on which I can do [b]no changes[/b]. With Middlegen I generate hbm.xml files and java files. On one table I like to use optimistic locking by version.
Is it possible to let Hibernate use an existing column as version column ?
My example table without optimistic locking: (A.hbm.xml)
[code]<hibernate-mapping>
<class name="data.hibernate.A" table="a">
<id name="Id" type="java.lang.String" column="ID">
<generator class="assigned" />
</id>
<property name="Ver" type="int" column="VER" not-null="true" length="11"/>
</class>
</hibernate-mapping>[/code]
I add this to make it work
[code]dynamic-update="true"
optimistic-lock="version"
<version column="`VER`" name="Ver"/>[/code]
When generating a java file from A.hbm.xml I get errors since there are two variables called "Ver"
Kindly submit any suggestion!
/capo
|
|