-->
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: Unidirectional bag/list problem
PostPosted: Tue Jan 15, 2008 3:52 pm 
Newbie

Joined: Wed Oct 31, 2007 1:50 pm
Posts: 13
I'm using NHibernate 1.2.

I've found some other posts, but haven't been able to resolve my issue from them.

Very simply, I have an Order class and mapping, which has an IList<LineItem> Basket property. Here is the Order.hbm.xml for the Basket property:
Code:
<bag name="Basket" fetch="join" cascade="all-delete-orphan">
    <key column="OrderUID" />
    <one-to-many class="Example.Model.LineItem" />
</bag>


OrderUID on the LineItem table is NOT-NULL=true. My problem is that I receive a cannot insert null into OrderUID. Obviously the OrderUID is not being populated during the Order Save/Update.

I have tried a bunch of things, but to no avail. Can someone help?
Code:
  <class name="Example.Model.LineItem" table="LineItem">
    <composite-id>
      <key-many-to-one name="Order" class="Example.Model.Order" column="OrderUID" />
      <key-property name="ProductId" />
    </composite-id>

    <property name="Quantity" column="Quantity" type="Int32" not-null="true"/>
    <property name="UnitPrice" column="UnitPrice" type="Decimal" not-null="true"/>
  </class>


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.