I’ve a formula field in my hbm file. Which is using a User Defined SQL Function. This function generates a sequence number.
<property name="RequisitionNo" column="RequisitionNo" formula="Aims.GenerateRequisitionNo()" not-null="true" generated="insert" />
<property name="IsReqForCustomerOrder" column="IsReqForCustomerOrder" not-null="true" />
<property name="SalesOrderNo" column="SalesOrderNo" not-null="false" />
<property name="IsActive" column="IsActive" not-null="true" />
But When Nhibernate generates insert query its ignoring the formula field. How can I insert sql function generated value into database.
Any Idea?
Thanks
The formula is a
read onlyvalue and cannot be written back to the database.Surely your answer here is to add
dbo.GenerateRequisitionNo()as a default on theRequisitionNocolumn and get rid of this formula column, this seems from first glance to be the correct route.