Another thing to note (and I could be wrong about this), I have never
noticed a manytoone relationship creating any generated methods for
the 'linked' object, only for the object in which manytoone is
defined.  However, onetomany adds methods to the 'child' table called
getParentxxx()   Example:  theme.getParentBook() would return the book
that 'owns' the given booktheme.  Which would sort of make the
composition relationship for getBook() obsolete.

On Oct 17, 10:58 am, Shawn <[EMAIL PROTECTED]> wrote:
> You still need to define the relationship in book.  I would do it like
> this:
>
> <object name="book" table="book" decorator="contentobjects.BaseBean">
> <id name="ID" column="BookID" type="numeric"/>
> <property name="Title" type="string"/>
> <property name="Summary" type="string"/>
> <property name="Author" type="string"/>
> <property name="Illustrator" type="string" nullable="true"/>
> <property name="DatePublished" type="date" nullable="true"/>
> <property name="BookImage" type="string"/>
>  <onetomany name="Theme">
>                                         <link to=booktheme" column="bookid" />
>                                         <collection type="array">
>                                         </collection>
>                                 </onetomany>
> </object>
>  <object name="booktheme" table="booktheme"
> decorator="contentobjects.BaseBean">
> <compositeid>
> <manytoone name="book"/>
> <manytoone name="theme"/>
> </compositeid>
> <manytoone name="book" lazy="true">
> <link to="stories.book" column="BookID"/>
> </manytoone>
> <manytoone name="theme" lazy="true">
> <link to="stories.theme" column="BookID"/>
> </manytoone>
> <property name="StarRating" type="numeric"/>
> </object>
>
> You can avoid recursion issues by setting lazy="true" on your
> manytoone composition relationships in the composite (as I did
> above).  With this relationship, you can pull up an array of all of
> the themes applied to a book with book.getThemeArray();  Since you
> have a composite key, it appears you can have multiple themes applied
> to a book.
>
> Also, if you don't care about composition on your composite key, you
> can also reference property instead instead of doing a composition
> relationship.  ie.,
>
> <object name="booktheme" table="booktheme"
> decorator="contentobjects.BaseBean">
> <compositeid>
>    <property name="bookID" column="bookID" />
>   <property name="themeID" column="themeID" />
> </compositeid>
> <property name="StarRating" type="numeric"/>
> </object>
>
> On Oct 17, 9:39 am, "Stephen Moretti" <[EMAIL PROTECTED]>
> wrote:
>
> > I think I've got the wrong end of the stick or something, but I don't seem
> > to be able to get a link relationship working that has a composite key. What
> > I have is :
>
> > book -< booktheme >- theme
>
> > so I have the following objects :
> > <object name="book" table="book" decorator="contentobjects.BaseBean">
> > <id name="ID" column="BookID" type="numeric"/>
> > <property name="Title" type="string"/>
> > <property name="Summary" type="string"/>
> > <property name="Author" type="string"/>
> > <property name="Illustrator" type="string" nullable="true"/>
> > <property name="DatePublished" type="date" nullable="true"/>
> > <property name="BookImage" type="string"/>
> > </object>
> >  <object name="booktheme" table="booktheme"
> > decorator="contentobjects.BaseBean">
> > <compositeid>
> > <manytoone name="book"/>
> > <manytoone name="theme"/>
> > </compositeid>
> > <manytoone name="book">
> > <link to="stories.book" column="BookID"/>
> > </manytoone>
> > <manytoone name="theme">
> > <link to="stories.theme" column="BookID"/>
> > </manytoone>
> > <property name="StarRating" type="numeric"/>
> > </object>
>
> > <object name="theme" table="theme" decorator="contentobjects.BaseBean">
> > <id name="ID" column="ThemeID" type="numeric"/>
> > <property name="Title" type="string"/>
> > <property name="UniqueName" type="string"/>
> > </object>
>
> > (Please don't ask why I'm aliasing my id's to ID instead of using the column
> > name - its a sore point)
>
> > For whatever reason, I kind of assumed that I would be able to see booktheme
> > in my book and theme objects via the generated methods,  but I'm not. I'm
> > not sure if I've got something wrong or what I need to do make book theme
> > appear in book or theme or even a struct/array of theme object in book, and
> > vice versa. I did think of putting a one to many in book, but then I have a
> > circular reference which invariably ends with a getMemento loop and a
> > 500 server error.
>
> > I don't know... kinda confused....   Any help would be appreciated.
>
> > Stephen
--~--~---------~--~----~------------~-------~--~----~
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer

You received this message because you are subscribed to the Google Groups 
"transfer-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to