-->
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.  [ 1 post ] 
Author Message
 Post subject: Parent/Child Mapping in multi-tiered relationship
PostPosted: Fri Jan 28, 2011 12:01 pm 
Beginner
Beginner

Joined: Fri Nov 13, 2009 4:05 pm
Posts: 30
Could someone illustrate the proper way to wire up your annotations in a parent/child relationship amongst 3 or more objects? For example, a purchase order has a header, multiple lines, and each line contains a collection of shipments:

PurchaseOrder (Pk = auto generated HEADER_ID)

PurchaseOrderLine (Pk = HEADER_ID + LINE_NUMBER)
PurchaseOrderLineShipment
PurchaseOrderLineShipment

PurchaseOrderLine (Pk = HEADER_ID + LINE_NUMBER + SHIPMENT_NUMBER)
PurchaseOrderLineShipment

For the child records, the line and shipment numbers are assigned by my code. What I see happen is that the HEADER_ID from the quote header gets set on the line records prior to their INSERT; however, I do not see this same behavior happen properly on the shipment level. When Hibernate goes to save the shipments, it errors saying that the HEADER_ID is NULL and that the table does not permit NULLs.

Any help is greatly appreciated.


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

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.