Hi to all!
I create the class hierarhy with an abstract class as root OrderLine
and two child OrderLineTypeA and OrderLineTypeB. And create another
class Order that has a collection ICollection<OrderLine>. If i define
OrderLine like "public class OrderLine{...}" in that case all work
fine:
Order o = new Order();
o.AddLine(new OrderLineTypeA());
o.AddLine(new OrderLineTypeB());
session.Save(o);
but if I define OrderLine as public abstract class OrderLine, than
NHibernate insert only Order.
mapping for collection in Order:
<set name="Lines" table="OrderLine" cascade="all" >
<key column="Order_Id" />
<one-to-many class="OrderLine" />
</set>
mapping for OrderLine:
<class name="OrderLine" table="OrderLine" where="Deleted='FALSE'"
abstract="true" >
<id name="Id">
<generator class="Genesis.Server.Infrastructure.GuidGenerator,
Genesis.Server.Infrastructure" />
</id>
<many-to-one name="Order" class="Genesis.Server.Domain.Orders.Order"
column="Order_Id"></many-to-one>
<joined-subclass name="OrderLineTypeA" table="OrderLineTypeA"
extends="OrderLine">
<key column="OrderLine_Id"></key>
</joined-subclass>
<joined-subclass name="OrderLineTypeB" table="OrderLineTypeB"
extends="OrderLine">
<key column="OrderLine_Id"></key>
</joined-subclass>
</class>
--
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.