Hello Everyone,
I have a new problem now. I have three tables Test1, Test2 and Test3
This is how it looks like
Test1
ID - PK
Version
EmpID
Name
Test2
ID - PK
Version
SomeOtherData
ManagerOf
WorkerOf
Test3
ID - PK
Version
EmpID
Name
This is a sample table created to test a situation we have in the existing data model we have to use due to political reason.
Here is the mapping for test2
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Oct 3, 2008 10:52:06 AM by Hibernate Tools 3.2.0.b9 -->
<hibernate-mapping>
<class name="com.mahen.Test2" table="TEST2">
<id name="id" type="big_decimal">
<column name="ID" precision="22" scale="0" />
<generator class="assigned" />
</id>
<many-to-one name="test1" class="com.mahen.Test1" fetch="select" cascade="all" property-ref="naturalId">
<column name="MANAGER_OF" />
<column name="VERSION" />
</many-to-one>
<many-to-one name="test3" class="com.mahen.Test3" fetch="select" cascade="all" property-ref="naturalIdTest3" >
<column name="WORKER_OF" />
<column name="VERSION" />
</many-to-one>
</class>
</hibernate-mapping>
Now when i run the test. It complains "Repeated column in mapping for entity: com.mahen.Test2 column: VERSION (should be mapped with insert="false" update="false")"
That make sense so I thought I'll put insert="false" update="false" for many-to-one name="test3". But if I do this it works but the value for WorkerOf is not set.
Which again make sense. Now I am stuck. I just want to set nsert="false" update="false" for version and not the other column. I did not find any way of setting just that. Can someone suggest me solution to this.
Thanks
Mahen
|