Hello all
I have 2 tables in DB
desc Employee
EMP_ID NUMBER<AUTO>
EMP_NAME VARCHAR
desc Salary
EMP_ID NUMBER<AUTO>
EMP_SALARY NUMBER
Both of them get mapped 2 class named
company.Employee
company.Salary
Now in company.Employee I want to keep reference of its Salary object, so now Employee.hbm.xml looks like
<hibernate-mapping>
<class name="company.Employee" table="EMPLOYEE">
<id name="id" column="EMP_ID">
<generator class="native"/>
</id>
<property name="name" type="text" column="EMP_NAME"/>
<one-to-one name="salary" class="company.Salary" outer-join="auto" />
</class></hibernate-mapping>
This works perfectly if I read from database, but If I save in database, than it won't save anything in Salary table, but only employee details are saved.,
Can anyone PLEASE point me out how to do this???
Following is Salary.hbm.xml file
<hibernate-mapping>
<class name="company.Salary" table="SALARY">
<id name="id" column="EMP_ID">
<generator class="native"/>
</id>
<property name="salary" type="java.lang.Integer" column="EMP_SALARY"/></class>
</hibernate-mapping>
TIA
|