That gets closer.  I added inverse="true" and cascade="all".  It now
updates/deletes correctly.

However, there is an issue when retrieving the collection.  It tries
to retrieve the bag key column from the class mapping (Invoice)
instead of from the join mapping (invoice_ext).

I ended up getting my stuff to work using joined-subclass instead.
But I'd still be interested in knowing whether this is an issue with
something I was doing or if it is a <join> issue.

On Fri, Oct 3, 2008 at 6:15 PM, Ayende Rahien <[EMAIL PROTECTED]> wrote:
> The <bag> should have inverse="true" on it, most probably
>
> On Fri, Oct 3, 2008 at 10:52 PM, marshal simmons <[EMAIL PROTECTED]>
> wrote:
>>
>> I am using <join> to map multiple tables to a single entity
>>
>> (http://ayende.com/Blog/archive/2007/04/24/Multi-Table-Entities-in-NHibernate.aspx).
>>  When I try to update a many-to-one within my join it is trying to
>> update the table defined at the class level instead of at the join
>> level.  Here is a piece of my mapping:
>>
>> Invoice Mapping:
>> <class name="Model.Invoice, Core" table="invoice">
>>        <id name="Key" column="inv_key" type="Guid"
>> unsaved-value="00000000-0000-0000-0000-000000000000">
>>                <generator class="guid" />
>>        </id>
>>        ...properties
>>    <join table="invoice_ext" inverse="true">
>>      <key column="inv_key_ext" />
>>      <many-to-one name="Application" class="Model.Application, Core"
>> column="inv_m01_key_ext" />
>>    </join>
>>
>> Application mapping (bag to invoice):
>>   <bag name="Invoices" lazy="true" table="invoice_ext">
>>            <key column="inv_m01_key_ext" />
>>            <one-to-many class="Model.Invoice, Core" />
>>    </bag>
>>
>> When I update the column being updated is correct but the table and
>> key are from the class definition (invoice) instead of the join
>> (invoice_ext).  Any ideas what I'm doing wrong?  Is it invalid to
>> define a many-to-one within a join?
>>
>>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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