Hi, I'm having some issues generating the DB schema for the following
model/mappings:


class abstract A
{ ... }

class abstract B : A
{ ... }

class X : B
{
       IList<Item> Items { get; }
}

class Y : B
{ ... }

class Z : A
{
       IList<Item> Items { get; }
}



<class name="A" table="A">
 <id name="ID" column="A_ID" type="Int32" unsaved-value="0">
   <generator class="identity" />
 </id>
 <property ... />
</class>

<joined-subclass name="B" table="B" extends="A">
 <key column="A_ID" />
 <property ... />
</joined-subclass>

<joined-subclass name="X" table="X" extends="B">
 <key column="A_ID" />
 <property ... />
 <bag name="Items" table="Items" access="field.camelcase">
   <key column="A_ID" />
   <composite-element class="Item">
     <property ... />
   </composite-element>
 </bag>
</joined-subclass>

<joined-subclass name="Y" table="Y" extends="B">
 <key column="A_ID" />
 <property ... />
</joined-subclass>

<joined-subclass name="Z" table="Z" extends="A">
 <key column="A_ID" />
 <property ... />
 <bag name="Items" table="Items" access="field.camelcase">
   <key column="A_ID" />
   <composite-element class="Item">
     <property ... />
   </composite-element>
 </bag>
</joined-subclass>


The schema that I'm looking for consists of a single "Items" table for
holding the elements of the collections in X and Y.
In order to achieve this, the foreing-key of this table should point
to "A", but with the shown mappings, the foreing-key generated points
to the table "X", hence I get a runtime error when trying to persist
an entity of type Z.

If the mappings are switched so that the mapping of Z appears before
than X, the foreing-key generated points to the table "Z" (I think it
is a little weird that the generated schema depends on the order of
the mappings)

Is there a way to specify that the foreing-key should point to table
"A"? Any hint?

Regards.

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