These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Complex ManyToMany
PostPosted: Thu Nov 29, 2007 4:40 am 
Beginner
Beginner

Joined: Thu Nov 29, 2007 4:36 am
Posts: 20
Hi,

Let's say one has this scenario:

CustomerOrder - table for the customer's orders
OrderDetail - link table between the order and the products. Besides the keys from CustomerORder and Product, the table has another column "quantity"

Now, the Product table, has subproducts that can be selected by the customer. So we need a many2many table between OrderDetail and Subproducts.

Now, in CustomerOrder, the OrderDetail is mapped as a composite-element. In OrderDetail, there is a many-to-many mapping with Subproduct.


The problem is that when i save or load a CustomerOrder , the subproducts are just ignored.

I'm thinking that when I save the order, it only knows about stuff that is in the composite-element, and I can't put a bag in there.
[/img]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 30, 2007 12:58 am 
Beginner
Beginner

Joined: Thu Nov 29, 2007 4:36 am
Posts: 20
up


Top
 Profile  
 
 Post subject: Re: Complex ManyToMany
PostPosted: Fri Nov 30, 2007 1:57 am 
Expert
Expert

Joined: Fri May 13, 2005 11:13 am
Posts: 292
Location: Rochester, NY
sirrocco wrote:
So we need a many2many table between OrderDetail and Subproducts.


Really? Usually in this example, each OrderDetail points to one and only one (Sub)product. It is the association link between the order and the products on it, with a quantity.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 02, 2007 3:12 am 
Beginner
Beginner

Joined: Thu Nov 29, 2007 4:36 am
Posts: 20
An order detail contains a product - so many subproducts can be selected for that product.

A subproduct can be in many OrderDetails , so ... i'm thinking many2many.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.