Sound like AddressGroup is a collection of addresses.  Through the 'collection-class' 
attribute on collection descriptors you can specify your own implementation of the 
collection class to use for a particular relationship.  I think it needs to implement 
Collection, but other than that it seems pretty straightforward.

<class-descriptor class="com.foo.Person">
   ...
   <collection-descriptor
      name="addresses"
      element-class-ref="com.foo.Address"
      collection-class="com.foo.AddressGroup
   >
      <inverse-foreignkey .../>
   </collection-descriptor>
</class-descriptor>


-----Original Message-----
From: Robert J Celestino [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 30, 2003 8:14 PM
To: OJB Users List
Subject: o/r mapping question


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]

Reply via email to