Hibernate version: JBoss4.0.1, Hibernate2.1
I know this has been gone through endlessly and I have been through all the post following the search on all forums.
I have got my composite-id working (and tested etc).
My problem is I cannot get the XDoclet to produce the correct hbm file for this composite-id (I have been to CodeHaus and seen XDoclet2 etc etc too).
At the moment I have repaired the hbm generated by XDoclet and overwrite the autogenerated one with my hand coded one (in my Ant scripts).
I cannot see a workaround to this (it seems the solutions are in the pipeline but not quite there yet).
To complete the story:
My composite table is Person_Organisation_List (person_id and org_id being primary keys with an extra (non-primary) attribute called designation, and no I cannot alter the schema).
Code:
public class PersonOrganisationList
{
private String designation = null;
private PersonOrgListPK primaryKey = null;
/**
*
* @hibernate.property column="designation" type="string" length="40"
* not-null="false"
*/
public String getDesignation()
...
/**
*
* @hibernate.id
*
*/
public PersonOrgListPK getPrimaryKey()
...
Code:
public class PersonOrgListPK implements Serializable
{
public Long person_id = new Long(0);
public Long org_id = new Long(0);
public PersonOrgListPK()
{
}
public PersonOrgListPK(Long person_id, Long org_id)
{
this.person_id = person_id;
this.org_id = org_id;
}
public Long getOrg_id()
...
public Long getPerson_id()
...
The hand repaired PersonOrganisationList.hbm.xml looks like:
Code:
<composite-id
name="primaryKey"
class="PersonOrgListPK"
>
<key-property name="org_id" type="long"/>
<key-property name="person_id" type="long"/>
</composite-id>
No matter what I do, at the moment XDoclet (v1.2.2) only produces
Code:
<composite-id
name="primaryKey"
class="PersonOrgListPK"
/>
Cheers
-raj