Hi,
I want to know how to map aggregated mapping of multiple objects (detils below) in the absense of database-identity key.
(I know hibernate allows in mapping multiple objects to a single row - where there is a primary key)
Aggregation:
1Report --has-- 1..* Company
1Company --has-- 1..* Currency
This is only fetching, no object manipulation required
Thanks
Prem
Data From a View V_REPORT in database:
RPT_DATE COMPANY_CODE CURRENCY_CODE AMT
10/16/2006 111 AUD 939425.79
10/16/2006 111 INR 1293.31
10/17/2006 111 THB 262764.81
10/17/2006 111 USD 280
10/16/2006 222 AUD 234926.45
10/16/2006 222 INR 393.33
10/16/2006 222 THB 65761.2
10/16/2006 222 USD 140
10/17/2006 444 AUD 10
10/17/2006 444 INR 20
I need the following object hierarchy (with appropriate composition):
I need the following object hierarchy (with appropriate composition):
1. Report(RPT_DATE=10/16/2006)
a. Company(CODE=111)
i. Currency(AUD, 939425.79)
ii. Currency(INR, 1293.31)
b. Company(CODE=222)
i. Currency(AUD, 234926.45)
ii. Currency(INR, 393.33)
iii. Currency(THB, 65761.2)
iv. Currency(USD, 140)
2. Report(RPT_DATE=10/17/2006) - similar as above
|