Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is it possible to use 2 composite-id in a hbm.xml

 
navinkumar sekar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you please tell, is it possible to use 2 composite-id in a single mapping like the following code snippet. If it's wrong how to use 2 referance variable in a single hbm.
-----------------------------------------------------------------------

Table Name: employee
coulmn : empNo,Name,Address.
constrain(empNo,Name)


class A
{

private B obj1;
private C obj2;
private String address;

get/set();
}

class B
{
private int emp_no;
get/set();
}

class C
{
private String name;
get/set();
}

Mapping.hbm.xml:

<class name="A" table="employee">

<composite-id name="obj1" class="B">
<key-property name="emp_no" type="int" column="empNo"/>
</composite-id>

<composite-id name="obj2" class="C">
<key-property name="name" type="string" column="name"/>
</composite-id>

<property name="address" column="Address" type="string"/>

</class>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic