<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   namespace="Domain.BusinessTransaction.Series"
                   assembly="Domain"
                   default-access="field.pascalcase-m-underscore"
                   default-lazy="false"
                   default-cascade="none" >
  <class name="BTSeries" table="BT_SERIES">
    <id name="Id" column="BT_SERIES_ID" unsaved-value="0">
      <generator class="seqhilo">
        <param name="sequence">BT_SERIES_SEQ</param>
<param name="max_lo">99</param>
      </generator>
    </id>

    <version name="Version" column="VERSION" unsaved-value ="0"
access="backfield" />

    <bag name="BusinessTransactions" cascade ="all-delete-orphan"
inverse="true" lazy="true">
      <key column="BT_SERIES_ID"/>
      <one-to-many
class="Domain.BusinessTransaction.BusinessTransaction"/>
    </bag>

    <component name="TransactionId"
class="Domain.BusinessTransaction.TransactionId" access="backfield">
      <property name="Value" column="TRANSACTION_ID" access="property"/
>
    </component>

    <property name="VoidedInVersion" column="VOIDED_IN_VERSION"/>
    <property name="WasPostedWithOptions"
column="WAS_POSTED_WITH_OPTIONS" access="property"/>
    <property name="LockedAt" column="LOCKED_AT" access="property"/>

  </class>
</hibernate-mapping>

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   namespace="Domain.BusinessTransaction"
                   assembly="Domain"
                   default-access="field.pascalcase-m-underscore"
                   default-lazy="false"
                   default-cascade="none" >
  <class name="BusinessTransaction" table="BUSINESS_TRANSACTION"
lazy="true">
    <id name="Id" column="BUSINESS_TRANSACTION_ID" unsaved-value="0">
    <generator class="seqhilo">
        <param name="sequence">BUSINESS_TRANSACTION_SEQ</param>
<param name="max_lo">99</param>
      </generator>
    </id>
!!!! REMOVED a bunch of stuff !!!!
</class>
</hibernate-mapping>


On Jan 5, 3:19 pm, "Paul Hinett" <[email protected]> wrote:
> Hi,
>
> I think you need to set cascade to true on your customer mapping.
>
> I'm no guru on this subject by any means but it might be what you are after.
>
> Paul
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf
>
> Of Shane C
> Sent: 05 January 2010 21:59
> To: nhusers
> Subject: [nhusers] Need associated Ids on Save
>
> Assume we are using seqhilo and we have the following...
>
> Customer
>    has many -> Order
>
> When I get a new Order in I add it to the Customer and then SaveOrUpdate the
> customer.  At this point my Order won't have an Id until I call a Flush().
>
> After a bit of reading I'm not sure how to get Order to have an Id without
> saving it directly and then adding it to the Customer.  There is talk about
> Persist() but it's not guaranteed to provide an Id so that means it's not a
> viable option.
>
> Any suggestions on how to get around this if we need the Id?
-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" 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/nhusers?hl=en.


Reply via email to