Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 1.0.4
Mapping documents:
Code:
<class name="MyAssembly.Relation, MyAssembly" table="Relation">
<id name="Id" type="Int32" column="RelationId">
<generator class="identity"/>
</id>
<property name="CreatedOn" column="CreatedOn" type="DateTime"/>
<joined-subclass name="MyAssembly.Person,MyAssembly" table="Person">
<key column="RelationId"/>
<property name="DateOfBirth" column="DateOfBirth" type="DateTime"/>
<property name="FirstName" column="FirstName" type="String"/>
" />
...
When storing a new Person, NHibernate creates a new (parent)record Relation.
In the database, we want CreatedOn to be database-generated datetimevalue.
However, NHibernate needs to add the Relationrecord first and than tries to store a NULL value for the CreatedOn property.
Is it possible to let NHibernate ignore the CreatedOn property when saving a new class to the database? If yes, how? If no, how to use database-generated default-values with NHibernate?