Thanks both,
I didn't linked in the xml mapping CashMovement to RrifLifDetail (sorry for that name) in a one-to-many relationship. I could do this, but it would not help me in the future. I need to be able to do some HQL join (and left join) between unlinked tables. Per exemple, I work with 2 databases (same database server) with 2 differents domain models (for each database), and linking everything between the 2 domain model would be too verbose.
To explain a bit the relationship this is how the 2 table are linked:
cashMovement.requestUid is the primary key of cashMovement and
rrifLifDetail.cashMvtRequestUid is a foreign key pointing to cashMovement.requestUid.
The orginal SQL look like this (the statement was simplified, removing the where clause, other left join and the order by...) :
Code:
SELECT DISTINCT CASHMOVEMENT.Request_UID,
CASHMOVEMENT.FromAccount,
RRIFLIFDETAIL.FkAccount_ID,
CASHMOVEMENT.SettlementDate,
CASHMOVEMENT.PaymentMethod,
CASHMOVEMENT.Amount,
RRIFLIFDETAIL.FedTaxAmount,
RRIFLIFDETAIL.ProvTaxAmount FROM CashMovement CASHMOVEMENT
LEFT JOIN RrifLifDetail RRIFLIFDETAIL ON RRIFLIFDETAIL.CashMvt_Request_UID= CASHMOVEMENT.Request_UID
Thanks for helping!
Etienne.