Hi,
In NHibernate 3.0 I have a problem with the mapping of the the
following hierarchy of classes:
Abstract class Parent
Id
ParentProperty
Class Child : Parent
ChildProperty
I have represented them with two tables:
Parent:
Id (pk)
ParentProperty
Child:
Id (pk and fk to Parent table)
ChildProperty
The mapping file contains this declaration:
<class name="Parent" table="Parent" abstract="true">
<!-- Identity mapping -->
<id name="Id" type="System.Int32" column="Id">
<generator class="identity" />
</id>
<property name="ParentProperty"/>
<joined-subclass name="Child" table="Child">
<key column="Id"/>
<property name="ChildProperty"/>
</joined-subclass>
</class>
When I save a Child object, Hibernate inserts only te Parent row, and
then this SQL Exception occurs:
{"could not insert: [Child#<null>][SQL: INSERT INTO Child
(ChildProperty, Id) VALUES (?, ?)]"}
Because parameter @p1 is not specified. In practice it tells me that
Id is not specified; Id is the key column of Child table and how can I
specify it?
How can I resolve this problem?
Thanks in advance
--
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.