[transfer-dev] Re: ManyToMany on a compositeid?

2008-11-12 Thread Mark Mandel

On Thu, Nov 13, 2008 at 4:53 AM, Ken Cummins [EMAIL PROTECTED] wrote:

 I *think* I understand now, but there's one problem: a compositeid
 can't contain a onetomany relationship.  Only manytoone,
 parentonetomany, or property.

But there is no way a o2m could be a compositeID. The FK could never
be on the table that way - its always on the child.



 Also, as a point of clarification, should there be foreign keys set up
 in the database itself, or is using the compositing of Transfer
 sufficient?

Of course you should use foreign keys... you don't like referential
integrity? ;)

Mark
-- 
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 transfer-dev@googlegroups.com
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
-~--~~~~--~~--~--~---



[transfer-dev] Re: ManyToMany on a compositeid?

2008-11-12 Thread Mark Mandel

Ooops!

That should be manytoone! My Bad!

(I did mention it was pseudo code, right?)

object name=cart
 id name=uuid /
 onetomany name=LineItems
  link to=LineItem /
 /onetomany
/object

object name=Product
 id name=uuid /
/object

object name=ProductOptions
 id name=uuid /
/object

object name=LineItem
 compositeid
parentonetomany class=cart /
manytoone name=Product /
manytoone name=ProductOption /
 /compositeid
 manytoone name=Product
   link to=Product /
 /manytoone
 manytoone name=ProductOption
   link to=ProductOption /
 /manytoone
/object

That should make more sense now :D

Mark

On Thu, Nov 13, 2008 at 8:29 AM, Ken Cummins [EMAIL PROTECTED] wrote:

 Ummm... From your earlier reply:

 object name=LineItem
  compositeid
 parentonetomany class=cart /
 onetomany name=Product /
 onetomany name=ProductOption /
  /compositeid

 :)

 But I see what you're saying about the o2m in a composite id.

 And I like referential integrity, I was just curious...  :)

 On Nov 12, 3:26 pm, Mark Mandel [EMAIL PROTECTED] wrote:
 On Thu, Nov 13, 2008 at 4:53 AM, Ken Cummins [EMAIL PROTECTED] wrote:

  I *think* I understand now, but there's one problem: a compositeid
  can't contain a onetomany relationship.  Only manytoone,
  parentonetomany, or property.

 But there is no way a o2m could be a compositeID. The FK could never
 be on the table that way - its always on the child.



  Also, as a point of clarification, should there be foreign keys set up
  in the database itself, or is using the compositing of Transfer
  sufficient?

 Of course you should use foreign keys... you don't like referential
 integrity? ;)

 Mark
 --
 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 transfer-dev@googlegroups.com
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
-~--~~~~--~~--~--~---



[transfer-dev] Re: ManyToMany on a compositeid?

2008-11-12 Thread Mark Mandel

You can't do this with m2m, it has to be an interim object in between.

Mark

On Thu, Nov 13, 2008 at 8:46 AM, Ken Cummins [EMAIL PROTECTED] wrote:

 Yes and no...

 Yes it makes more sense, but I do not think it means what I want it to
 mean (to paraphrase Inigo Montoya)...

 From how I read your pseudo-code, each LineItem can only be related to
 one ProductOption.  I need to be able to relate it to many options.
 My problem is trying to link *back* to the LineItem from a m2m link in
 LineItem.  Since we need to identify both ends of the connection, I
 would have to be able to identify the composite id of the LineItem.
 But m2m only recognizes two links, and I'd need three (the two parts
 to the line item composite id and the option id).

 Ken

 On Nov 12, 3:35 pm, Mark Mandel [EMAIL PROTECTED] wrote:
 Ooops!

 That should be manytoone! My Bad!

 (I did mention it was pseudo code, right?)

 object name=cart
  id name=uuid /
  onetomany name=LineItems
   link to=LineItem /
  /onetomany
 /object

 object name=Product
  id name=uuid /
 /object

 object name=ProductOptions
  id name=uuid /
 /object

 object name=LineItem
  compositeid
 parentonetomany class=cart /
 manytoone name=Product /
 manytoone name=ProductOption /
  /compositeid
  manytoone name=Product
link to=Product /
  /manytoone
  manytoone name=ProductOption
link to=ProductOption /
  /manytoone
 /object

 That should make more sense now :D

 Mark



 On Thu, Nov 13, 2008 at 8:29 AM, Ken Cummins [EMAIL PROTECTED] wrote:

  Ummm... From your earlier reply:

  object name=LineItem
   compositeid
  parentonetomany class=cart /
  onetomany name=Product /
  onetomany name=ProductOption /
   /compositeid

  :)

  But I see what you're saying about the o2m in a composite id.

  And I like referential integrity, I was just curious...  :)

  On Nov 12, 3:26 pm, Mark Mandel [EMAIL PROTECTED] wrote:
  On Thu, Nov 13, 2008 at 4:53 AM, Ken Cummins [EMAIL PROTECTED] wrote:

   I *think* I understand now, but there's one problem: a compositeid
   can't contain a onetomany relationship.  Only manytoone,
   parentonetomany, or property.

  But there is no way a o2m could be a compositeID. The FK could never
  be on the table that way - its always on the child.

   Also, as a point of clarification, should there be foreign keys set up
   in the database itself, or is using the compositing of Transfer
   sufficient?

  Of course you should use foreign keys... you don't like referential
  integrity? ;)

  Mark
  --
  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 transfer-dev@googlegroups.com
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
-~--~~~~--~~--~--~---



[transfer-dev] Re: ManyToMany on a compositeid?

2008-11-12 Thread Ken Cummins

I kinda thought that, but somehow got it in my head that the m2m
definition somehow encapsulated that interim object/table.

Thank you for the time explaining this to me, as it's helped me
understand Transfer that much more!

Cheers!

Ken

On Nov 12, 4:23 pm, Mark Mandel [EMAIL PROTECTED] wrote:
 You can't do this with m2m, it has to be an interim object in between.

 Mark



 On Thu, Nov 13, 2008 at 8:46 AM, Ken Cummins [EMAIL PROTECTED] wrote:

  Yes and no...

  Yes it makes more sense, but I do not think it means what I want it to
  mean (to paraphrase Inigo Montoya)...

  From how I read your pseudo-code, each LineItem can only be related to
  one ProductOption.  I need to be able to relate it to many options.
  My problem is trying to link *back* to the LineItem from a m2m link in
  LineItem.  Since we need to identify both ends of the connection, I
  would have to be able to identify the composite id of the LineItem.
  But m2m only recognizes two links, and I'd need three (the two parts
  to the line item composite id and the option id).

  Ken

  On Nov 12, 3:35 pm, Mark Mandel [EMAIL PROTECTED] wrote:
  Ooops!

  That should be manytoone! My Bad!

  (I did mention it was pseudo code, right?)

  object name=cart
   id name=uuid /
   onetomany name=LineItems
link to=LineItem /
   /onetomany
  /object

  object name=Product
   id name=uuid /
  /object

  object name=ProductOptions
   id name=uuid /
  /object

  object name=LineItem
   compositeid
  parentonetomany class=cart /
  manytoone name=Product /
  manytoone name=ProductOption /
   /compositeid
   manytoone name=Product
 link to=Product /
   /manytoone
   manytoone name=ProductOption
 link to=ProductOption /
   /manytoone
  /object

  That should make more sense now :D

  Mark

  On Thu, Nov 13, 2008 at 8:29 AM, Ken Cummins [EMAIL PROTECTED] wrote:

   Ummm... From your earlier reply:

   object name=LineItem
compositeid
   parentonetomany class=cart /
   onetomany name=Product /
   onetomany name=ProductOption /
/compositeid

   :)

   But I see what you're saying about the o2m in a composite id.

   And I like referential integrity, I was just curious...  :)

   On Nov 12, 3:26 pm, Mark Mandel [EMAIL PROTECTED] wrote:
   On Thu, Nov 13, 2008 at 4:53 AM, Ken Cummins [EMAIL PROTECTED] wrote:

I *think* I understand now, but there's one problem: a compositeid
can't contain a onetomany relationship.  Only manytoone,
parentonetomany, or property.

   But there is no way a o2m could be a compositeID. The FK could never
   be on the table that way - its always on the child.

Also, as a point of clarification, should there be foreign keys set up
in the database itself, or is using the compositing of Transfer
sufficient?

   Of course you should use foreign keys... you don't like referential
   integrity? ;)

   Mark
   --
   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 transfer-dev@googlegroups.com
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
-~--~~~~--~~--~--~---



[transfer-dev] Re: ManyToMany on a compositeid?

2008-11-11 Thread Kenneth Cummins

H...  ASCII art might be tough.  Maybe this will help:

object name=items table=cart_items
compositeid
manytoone name=cart /
manytoone name=products /
/compositeid  

manytoone name=cart
link to=cart.cart column=cart_id /
/manytoone

manytoone name=products
link to=products.products 
column=products_id /
/manytoone

manytomany name=options
table=cart_item_has_options
link to=cart.items column=cart_id 
/
link to=cart.items 
column=product_id /
link to=products.options 
column=options_id /
collection type=array
order property=options_id 
order=asc /
/collection
/manytomany
/object

As you can see, there is a compositeid for cart.items, each component
of which is a manytoone link to different tables.  But when I try to
set up the manytomany link to products.options, I don't have a key to
link back to the cart.items.  Does that make more sense?


On Tue, Nov 11, 2008 at 3:41 PM, Mark Mandel [EMAIL PROTECTED] wrote:

 Ken - can you write this out in some more details (ASCII art maybe), I
 having trouble following what you are trying to do.

 Mark

 On Wed, Nov 12, 2008 at 5:57 AM, Ken Cummins [EMAIL PROTECTED] wrote:
 
  I may be doing this all wrong, since this is my first serious
  application.  So I welcome comments and critiques...
 
  I'm building the ubiquitous shopping cart.  I'm building it because it
  needs some special functionality that's not easily hacked onto
  existing packages.
 
  Anyway, I figured I'd start with a simple cart.  So I have a Cart
  table with an ID (Transfer-managed UUID) and some other minor data.
  This has a OneToMany relationship with a Line Items table.
 
  The Line Items table uses a compositeid of the Cart ID and the line
  number.
 
  The Line Items table has a ManyToOne relationship to the Products
  table, which is no probem.
 
  The kicker is that I want a ManyToMany relationship with the Product
  Options table, but since the compositeid isn't treated as a single
  property, I can't really get the link properly set up.
 
  Am I doing something phenomenally wrong, or am I trying to get too
  elegant by avoiding a superfluous datum for a Line Item ID?
 
  Ken
  
 



 --
 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 transfer-dev@googlegroups.com
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
-~--~~~~--~~--~--~---



[transfer-dev] Re: ManyToMany on a compositeid?

2008-11-11 Thread Mark Mandel

Don't know why this isn't going to the google group.

Mark

On Wed, Nov 12, 2008 at 9:50 AM, Mark Mandel [EMAIL PROTECTED] wrote:
 Right - So, something like (very pseudo code):

 object name=cart
  id name=uuid /
  onetomany name=LineItems
   link to=LineItem /
  /onetomany
 /object

 object name=Product
  id name=uuid /
 /object

 object name=ProductOptions
  id name=uuid /
 /object

 object name=LineItem
  compositeid
 parentonetomany class=cart /
 onetomany name=Product /
 onetomany name=ProductOption /
  /compositeid
  onetomany name=Product
link to=Product /
  /onetomany
  onetomany name=ProductOption
link to=ProductOption /
  /onetomany
 /object

 That's pretty much it.

 You should have a look at the sample applications for more examples of
 compositions, and
 http://docs.transfer-orm.com/wiki/Managing_Relationships_and_Compositions.cfm

 Mark


 On Wed, Nov 12, 2008 at 9:37 AM,  [EMAIL PROTECTED] wrote:
 Alright...

 Cart has a generated UUID.
 Product has a generated UUID.
 ProductOptions has a generated UUID.

 LineItem has a composite primary ID of CartID and ProductID, and a column
 for the ProductOptionID.

 When I try to set up the M2M definition to ProductOptions, how to I
 reference the parent link? I can't reference *both* portions of the primary
 key, as there can only be 2 link / children of the manytomany / object.
 I've sidestepped the problem (for now) by using a UUID for the LineItem
 table as well, which gives me only two references for my M2M definition.

 On Nov 11, 2008 4:29pm, Mark Mandel [EMAIL PROTECTED] wrote:




 --
 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 transfer-dev@googlegroups.com
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
-~--~~~~--~~--~--~---