Yeah, you may have to do some Decorator shenanigans to get this to map
correctly.

Mark

On Fri, Dec 19, 2008 at 2:05 AM, Ken Cummins <[email protected]> wrote:
>
> And for clarity:
>
> Product
> -----------
> productkey (PK)
>
> Page
> -------
> productkey (PK :: o2m child FK to Product)
> pageno (PK)
>
> Text
> -------
> productkey (PK :: o2m child FK to Page)
> pageno (PK :: o2m child FK to Page)
> textno (PK)
>
> As you can see, the PKs are the FKs to the next parent, plus some
> additional identifier.  The product contains pages, which contain text
> elements.  If I need to get all the text elements for a product, I can
> build the TQL query easily enough.
>
> Ken
>
> On Dec 18, 9:00 am, Ken Cummins <[email protected]> wrote:
>> I actually agree with you, I've just been working with the schema as
>> it was given to me.  I'll have to work out how the change may impact
>> other parts of the application.
>>
>> It would be nice to have composite FKs, and/or be able to use a column
>> for more than one relationship...  ;)
>>
>> Ken
>>
>> On Dec 17, 5:15 pm, "Mark Mandel" <[email protected]> wrote:
>>
>> > This right?
>>
>> > Product
>> > -------------------
>> > ProductID
>>
>> > Page
>> > -------------------
>> > ProductID (FK to product)
>> > PageNumber
>>
>> > Text
>> > -------------------
>> > ProductID (FK to product)
>> > PageNumber (FK to Page:PageNumber)
>>
>> > Why not map this as:
>>
>> > Product
>> > -------------------
>> > ProductID (PK)
>>
>> > Page
>> > -------------------
>> > PageID (PK)
>> > ProductID (FK to product)
>> > PageNumber
>>
>> > Text
>> > -------------------
>> > PageID(PK, FK to Page)
>>
>> > And everyone is happy, and it is a helleva lot easier to map in Transfer.
>>
>> > Mark
>>
>> > On Thu, Dec 18, 2008 at 10:04 AM, Ken Cummins <[email protected]> 
>> > wrote:
>>
>> > > Ah!  There can be any number of text elements per page, depending on
>> > > the format of that particular page.  And the user can change the
>> > > format of the page on the fly.  Therefore, you need to know which text
>> > > element of which page of the product.  And the pages do not have a
>> > > monolithic PK, as you can have any number of pages per product.
>>
>> > > Here's a very fast (and likely ugly) attempt at an ER diagram...
>>
>> > > Product | ProductID  <------<<  Page | ProductID* | PageNumber <------
>> > > << Text | ProductID** | PageNumber** | TextElementNumber
>>
>> > > * FK from page to product (o2m for Product.getPageArray())
>> > > ** FK from text element to page (o2m for Page.getTextArray())
>>
>> > > There is also a o2m from Product to Text with a condition of
>> > > Text.PageNumber = 0 (I'd rather set up a page 0, but I have to deal
>> > > with a manager...)
>>
>> > > Ken
>>
>> > > On Dec 17, 4:54 pm, "Mark Mandel" <[email protected]> wrote:
>> > >> Sorry.. still not getting it.
>>
>> > >> Why not just have a FK -> PK relationship between Page and Text?
>> > >> That's not hard coded.
>>
>> > >> It seems that there would only be one Text element per page? or am I
>> > >> misunderstanding? I don't know what the ER diagram is.
>>
>> > >> Mark
>>
>> > >> On Thu, Dec 18, 2008 at 8:46 AM, Ken Cummins 
>> > >> <[email protected]> wrote:
>>
>> > >> > Because each page could have a different layout, and the number of
>> > >> > text blocks could differ.  So I need to track which text block on
>> > >> > which page for which product.  If it helps you visualize the issue,
>> > >> > there will also be image components on each page...
>>
>> > >> > These are user-designed products, so they are highly dynamic.  Hard-
>> > >> > coding a solution isn't going to work...  :P
>>
>> > >> > Ken
>>
>> > >> > On Dec 17, 3:41 pm, "Mark Mandel" <[email protected]> wrote:
>> > >> >> I'm trying to work my way through your mapping....
>>
>> > >> >> Why not just link the page directly to a specific text? How come you
>> > >> >> need all the messing about with products and page numbers?
>>
>> > >> >> Mark
>>
>> > >> >> On Thu, Dec 18, 2008 at 3:23 AM, Ken Cummins 
>> > >> >> <[email protected]> wrote:
>>
>> > >> >> > Gah!  Yet again, I post before my coffee activates...
>>
>> > >> >> > The link for the example object *should* be:
>>
>> > >> >> > <link column="productkey" to="Products.Text" />
>>
>> > >> >> > The idea is that the text objects are part of a o2m relationship 
>> > >> >> > with
>> > >> >> > the product, but that also reference the pageno.  Now, I'd like to
>> > >> >> > have a o2m relationship from product to page, then another o2m
>> > >> >> > relationship from page to text. This will be extended to other 
>> > >> >> > objects
>> > >> >> > as well.
>>
>> > >> >> > Would I be better off scrapping the direct o2m product to text, and
>> > >> >> > adding a function into the decorator? Or can I get transfer to 
>> > >> >> > handle
>> > >> >> > the complex data modelling?
>>
>> > >> >> > Ken
>>
>> > >> >> > On Dec 17, 10:02 am, Ken Cummins <[email protected]> wrote:
>> > >> >> >> I'm looking (still) at a table with a compositeid that I want to 
>> > >> >> >> be
>> > >> >> >> the parent of a onetomany relationship. I am considering using one
>> > >> >> >> portion of the compositekey as the o2m key, and adding a 
>> > >> >> >> condition to
>> > >> >> >> filter it to the second part of the key.
>>
>> > >> >> >> My question (and this is without a lengthy bout of of my usual 
>> > >> >> >> test/
>> > >> >> >> alter/test/alter/test/try to remember where I was/alter several 
>> > >> >> >> things/
>> > >> >> >> test/wish I had backed things up/drink more coffee cycle) is if I 
>> > >> >> >> can
>> > >> >> >> reference the current object in my where clause.  i.e.:
>>
>> > >> >> >> <object name="page" table="productpages" 
>> > >> >> >> decorator="BaseDecorator">
>> > >> >> >>         <compositeid>
>> > >> >> >>                 <parentonetomany class="Products.Product" />
>> > >> >> >>                 <property name="pageno" />
>> > >> >> >>         </compositeid>
>> > >> >> >>         <property name="stylekey" type="numeric" />
>> > >> >> >>         <onetomany name="text" lazy="true">
>> > >> >> >>                 <link column="productkey" to="Products.Product" />
>> > >> >> >>                 <collection type="array">
>> > >> >> >>                         <condition where="pageno = {pageno}"/>
>> > >> >> >>                         <order property="textno" />
>> > >> >> >>                 </collection>
>> > >> >> >>         </onetomany>
>> > >> >> >> </object>
>>
>> > >> >> >> This also brings up the problem of using the key for a o2m child 
>> > >> >> >> as
>> > >> >> >> part of the o2m parent relationship...  Grrr...
>>
>> > >> >> >> Ken
>>
>> > >> >> --
>> > >> >> E: [email protected]
>> > >> >> W:www.compoundtheory.com
>>
>> > >> --
>> > >> E: [email protected]
>> > >> W:www.compoundtheory.com
>>
>> > --
>> > E: [email protected]
>> > W:www.compoundtheory.com
> >
>



-- 
E: [email protected]
W: www.compoundtheory.com

--~--~---------~--~----~------------~-------~--~----~
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