Can generated timestamp fields be used with subclasses defined with a discriminator column?
It works great for for inserting any classes, and child classes that are not subclasses. However when I use it to insert a child record it get an error because the last_update_date can not be set to null.
Here's part of my xml definition for the subclass:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Pa.Domain" namespace="Pa.Domain">
<class name="Pa.Domain.Settle" table="Settle" discriminator-value="0" >
<id name="Id" column="UNIQUE_ID" type="int" >
<generator class="assigned"/>
</id>
<discriminator
formula="(select n.subclass_name from numeric_code n where n.unique_id = TYPE_ID)"
type="String"
/>
<timestamp name="LastUpdateDate" column="LAST_UPDATE_DATE" generated="always" unsaved-value="null"/>
<property column="CREATION_DATE" type="DateTime" name="CreationDate" generated="insert" />
...
<subclass name="SettleBatch"
discriminator-value="PTBSettle">
...
The above is a child class defined in the parent as:
Code:
...
<bag name="SettleList" inverse="true" lazy="true" cascade="all">
<key column="P_ID" />
<one-to-many class="Pa.Domain.Settle,Pa.Domain" />
</bag>
...
Any suggestions? Thanks
DP