javax.servlet.ServletException: org.hibernate.exception.SQLGrammarException: could not execute query
I dont think it's really relevant of my problem. Does anybody have a <join> example to gave me ? :(
The ones of the hibernate documentation are not so helpy to me
I have been trying this :
Code:
<join table="PERSON"
inverse="true"
optional="true" >
<key column="ID" />
<many-to-one name="fkSubscriber" class="dao.person.Person"
column="CUSTOMER" not-null="true"/>
</join>
I obtain this sql :
Code:
select
contract0_.ID as ID4_,
contract0_.ID_PERSON as ID2_4_,
contract0_.ISSUED_AT as ISSUED5_4_,
contract0_.NAME as NAME4_,
contract0_1_.FIRSTNAME as FIRSTNAME5_
from myDB.contract contract0_
left outer join PERSON contract0_1_
on contract0_.ID=contract0_1_.ID
It's almost it, but it seems that Hibernate join automatically the id of the curent table (T_CONTRACT) but i need to join my table from an another id named ID_PERSON, so I could get :
Code:
left outer join PERSON contract0_1_
on contract0_.ID_PERSON=contract0_1_.ID
How can i set that ?