Hi
You should save two objects which mapping with composite-id
your mapping file may like
Code:
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping
>
<class
name="lk.wts.Test"
table="Test"
>
<composite-id
>
<key-property
name="id"
type="java.lang.String"
column="id"
/>
<key-property
name="direction"
type="java.lang.String"
column="direction"
/>
</composite-id>
<property
name="otherData"
type="java.lang.String"
update="false"
insert="false"
column="otherData"
/>
</class>
</hibernate-mapping>
Test a=new Test();
a.setId("id1");
a.setDirection("dir1");
a.setOtherData("data1");
session.save(a);
Test b=new Test();
b.setId("id1");
b.setDirection("dir2");
b.setOtherData("data2");
session.save(b);
Amila
(Don't forget to rate if helps)