Hi Jon,

you are right, if you want to create a mapping between OneObject and
ManyObject you have to add a foreignkey column to ManObject.

There is one other possibility. You can implement Persistence interface
and generate the relation by hand (code) in onLoad() method. As far as I
remember is this demonstrated somewhere in our example application.

Regards
Ralf


Jon Wilmoth schrieb:
> I'm using 1.2 JDO and I'm pretty sure I already know the answer to this
> question, but I thought I'd ask just in case I overlooked something.  Is
> it possible to create a one-to-many JDO mapping where the column used on
> the many object doesn't refer to the ID of the one, but rather another
> column on the one object?
> 
>  
> 
> For example if object model looked something like this:
> 
>  
> 
> ManyObject
> 
> -id (object id/pk)
> 
> -name
> 
> -category
> 
>  
> 
> OneObject
> 
> -id (object id/pk)
> 
> -category
> 
> -manyObjects (collection of 'ManyObject's where OneObject.category ==
> ManyObject.category)
> 
>  
> 
> So the mapping would look something like:
> 
> <field name="manyObjects" type="ManyObject" collection="vector">
>   <sql many-key="category"/>
> </field>
> 
>  
> 
> I believe the only way to do this currently would be to change
> "ManyObject" to add a fk field that held the value of OneObject.id.
> 
> <field name="manyObjects" type="ManyObject" collection="vector">
>   <sql many-key="one_object_id"/>
> </field>
> 
>  
> 
> Thanks,
> 
> Jon
> 
>  
> 
> Thanks,
> 
> Jon
> 

-- 

Syscon Ingenieurbüro für Meß- und Datentechnik GmbH
Ralf Joachim
Raiffeisenstraße 11
72127 Kusterdingen
Germany

Tel.   +49 7071 3690 52
Mobil: +49 173 9630135
Fax    +49 7071 3690 98

Internet: www.syscon.eu
E-Mail: [EMAIL PROTECTED]

Sitz der Gesellschaft: D-72127 Kusterdingen
Registereintrag: Amtsgericht Stuttgart, HRB 382295
Geschäftsleitung: Jens Joachim, Ralf Joachim

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to