posted 18 years ago
I have the following datamodel: (Apologies if the Kleene shorthand isn't in preferred format)
Order 1 => * Credit
Order * => 1 LoanPopulation
LoanPopulation 1 => + Loan
Loan 1 => * Credit
Now, the problem is that for a given object graph (say, I want to fetch an Order and its associated components) the Credit object is uniquely keyed on order_id and loan_id.
The net-net of this is that I can create a DAO that will fetch this object by supplying the two keys explicitly (obviously) but I cannot seem to set up a mapping that will allow Hibernate to automatically load the appropriate one because of the composite dependency (ie, I can load the Order, then the Loan Population, then the Loans, but to get Credit, I need the order_id which isn't a column in Loan that I can join on).
Any help much appreciated.