Hi list,
I was wondering if it was possible to have a class that maps through
multiple tables of my database, just retrieving the essential fields I
need. Those classes are for displaying purposes only, so no persistence
is needed.
Example Case: I have the following db:
CUSTOMER 1--->N CONTRACTS
CONTRACTS 1---->N PROJECTS
PROJECTS N----->N DEVELOPERS (with a NN mapping table in betw
een)
Having the customer Id, I want to display all developers
assigned to that customer (e.g. last name & first name, no other
information from developers or any other table).
As a newbie I do not know how should this be done?
My suppositions are,
1. I can do this entirely in my mapping xml, being able to specifying my
references CUSTOMER.OID matches CONTRACTS.CUSTOMER_OID and so on. But I
couldn't find anything in the documentation going this way.
2. Use 'extends', but I do not see how to do this. And my identities do
not share the same identity. Should I create a view of all my tables and
extend them together, so I do not use extend to my 'main tables
classes'?
3. Handle the mapping through my tables in my java classes, but I do not
like this idea very much. Seems too heavy, and you loose the utility of
the mapping files. And I would like to keep my classes as simple as
possible, just sets & gets, no other logic.
4. Or all of this is wrong, and somebody knows how to do this the
cleanest way...
As in most projects 90% of the time we need to display information an
easy way of mapping through different tables only retrieving the needed
fields would considerably speed up development time. And that's what I
am looking for.
Explanations or examples would be greatly appreciated,
Have a great Monday,
Xavier Cosyns;
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev