How about this:
public class Person {
private AddressGroup fAddressGroup;
...
/** Convenience method: create AddressGroup and set addresses indirectly */
public void setAddresses(List addresses) {
fAddressGroup = new AddressGroup(addresses);
}
/** Convenience method: retrieve addresses from my AddressGroup */
public List getAddresses() {
return fAddressGroup.getAddresses();
}
}
Map Person to the PERSON table and Address to the ADDRESS table; nothing weird
required in repository.xml.
-steve
Steve Clark
Technology Applications Team
Natural Resources Research Center/USGS
[EMAIL PROTECTED]
(970)226-9291
>List-Id: "OJB Users List" <ojb-user.db.apache.org>
>Subject: o/r mapping question
>Date: Thu, 30 Oct 2003 21:14:16 -0500
>Thread-Topic: o/r mapping question
>From: "Robert J Celestino" <[EMAIL PROTECTED]>
>To: "OJB Users List" <[EMAIL PROTECTED]>
>
>Hello all,
>
>I am stumped by what is posibly a very simple mapping problem.
>
>Consider something like this
> Person is stored in the person table
> Person has-a AddressGroup. AddressGroup is not stored in the DB
> AddressGroup has a list of Addresses
> Address is stored in the address table. Has a column
> called PersonId that indicates the person it belongs to
>
>This is a little contrived but bear with me.
>
>Clearly Person could have a list of addresses, but for various reasons it has
the intermediate class AddressGroup instead.
>
>I know how to solve this if AddressGroup was stored in the DB, but it is not.
It is purely a domain class.
>
>How can I get ojb to create and write this class without actually writing it to
the db?
>
>Thanks very much
>Bob c
>
>----------------------------------------------------------------
>Bob Celestino
>SAS Research and Development
>919 - 531 - 9425
>[EMAIL PROTECTED]
>
>SAS - The Power to Know
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]