Hello.
I have problems writing my mapping file. Here is my situation :
a table T_CONTRACT and a table T_CLIENT. T_CONTRACT is containing an id of T_CLIENT (representing the subsriber).
I would like to make a join between those 2 table so that i can get something like
Code:
Contract ct = ContractDAO.findById(1);
Client cl = ct.getFkSubscriber();
so far, i get to write this :
Contract.hbm.xmlCode:
<hibernate-mapping package="dao.person">
<class name="Contract" table="contract">
<id name="id" type="int">
<column name="ID" />
<generator class="identity" />
</id>
<property name="idSubscriber" type="int">
<column name="ID_CLIENT" not-null="true" />
</property>
<join table="CLIENT" inverse="true" optional="true">
<key column="ID" unique="true"/>
<many-to-one name="fkSubscriber" column="ID_CLIENT"
class="dao.client.Client" not-null="true" unique="true"/>
</join>
</class>
</hibernate-mapping>
Client.hbm.xmlCode:
<hibernate-mapping package="dao.client">
<class name="Cient" table="client">
<id name="id" type="int">
<column name="ID" />
<generator class="identity" />
</id>
...
</class>
</hibernate-mapping>
But it doesn't work at all (a sql syntax exception is raised)
Can someone help me please ?