NHibernate is working fine except for this one odd problem. I load an object, change a date field, then Update it. Does not save the data though.
Here is the method:
Code:
Dim task As BusinessTaskVw = NHibernateHelper.Load(GetType(BusinessTaskVw), taskId)
task.DateCompleted = Date.Now
NHibernateHelper.Update(task)
And thehelper method:
Code:
Dim session As ISession = Nothing
Dim tx As ITransaction = Nothing
Try
session = NHibernateHelper.GetCurrentSession()
tx = session.BeginTransaction()
session.Update(entity)
Finally
If Not tx Is Nothing Then
tx.Commit()
End If
If Not session Is Nothing Then
NHibernateHelper.CloseSession()
End If
End Try
The mapping file:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="ca.bc.gov.cserv.lgis.businessentity.BusinessTaskVw,ca.bc.gov.cserv.lgis.businessentity" table="BUSINESS_TASK_VW" lazy="false" mutable="false">
<id name="Id" column="ID" type="Decimal">
<generator class="sequence">
<param name="sequence">BUSINESS_TASK_VW_seq</param>
</generator>
</id>
<property column="TASK_TYPE_CODE" type="String" name="TaskTypeCode" />
<property column="OBJECT_TYPE_CODE" type="String" name="ObjectTypeCode" />
<property column="OBJECT_ID" type="Decimal" name="ObjectId" />
<property column="ROLE_CODE" type="String" name="RoleCode" />
<property column="COMMENTS" type="String" name="Comments" />
<property column="DATE_ASSIGNED" type="DateTime" name="DateAssigned" />
<property column="DATE_STARTED" type="DateTime" name="DateStarted" />
<property column="DATE_COMPLETED" type="DateTime" name="DateCompleted" />
</class>
</hibernate-mapping>
And finally the log:
Code:
2007-03-09 17:50:00,391 [7] DEBUG ca.bc.gov.cserv.frameworks.dataaccess.NHibernateHelper - Update Start
2007-03-09 17:50:00,391 [7] DEBUG ca.bc.gov.cserv.frameworks.dataaccess.NHibernateHelper - GetCurrentSession Start
2007-03-09 17:50:00,391 [7] DEBUG NHibernate.Impl.SessionImpl - opened session
2007-03-09 17:50:00,391 [7] DEBUG ca.bc.gov.cserv.frameworks.dataaccess.NHibernateHelper - GetCurrentSession End
2007-03-09 17:50:00,391 [7] DEBUG NHibernate.Transaction.AdoTransaction - begin
2007-03-09 17:50:00,391 [7] DEBUG NHibernate.Connection.DriverConnectionProvider - Obtaining IDbConnection from Driver
2007-03-09 17:50:00,391 [7] DEBUG NHibernate.Impl.SessionImpl - immutable instance passed to doUpdate(), locking
2007-03-09 17:50:00,391 [7] DEBUG NHibernate.Impl.SessionImpl - reassociating transient instance: [ca.bc.gov.cserv.lgis.businessentity.BusinessTaskVw#13]
2007-03-09 17:50:00,391 [7] DEBUG NHibernate.Transaction.AdoTransaction - commit
2007-03-09 17:50:00,391 [7] DEBUG NHibernate.Impl.SessionImpl - flushing session
2007-03-09 17:50:00,391 [7] DEBUG NHibernate.Impl.SessionImpl - Flushing entities and processing referenced collections
2007-03-09 17:50:00,391 [7] DEBUG NHibernate.Impl.SessionImpl - Processing unreferenced collections
2007-03-09 17:50:00,391 [7] DEBUG NHibernate.Impl.SessionImpl - scheduling collection removes/(re)creates/updates
2007-03-09 17:50:00,391 [7] DEBUG NHibernate.Impl.SessionImpl - Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
2007-03-09 17:50:00,391 [7] DEBUG NHibernate.Impl.SessionImpl - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
2007-03-09 17:50:00,391 [7] DEBUG NHibernate.Impl.Printer - listing entities:
2007-03-09 17:50:00,391 [7] DEBUG NHibernate.Impl.Printer - ca.bc.gov.cserv.lgis.businessentity.BusinessTaskVw{ObjectTypeCode=APPL, DateAssigned=3/9/2007, RoleCode=TECH, DateCompleted=3/9/2007, Id=13, DateStarted=null, TaskTypeCode=TECHREVIEW, ObjectId=178, Comments=tech review}
2007-03-09 17:50:00,391 [7] DEBUG NHibernate.Impl.SessionImpl - executing flush
2007-03-09 17:50:00,391 [7] DEBUG NHibernate.Impl.SessionImpl - post flush
2007-03-09 17:50:00,391 [7] DEBUG NHibernate.Impl.SessionImpl - transaction completion
2007-03-09 17:50:00,391 [7] DEBUG NHibernate.Transaction.AdoTransaction - running AdoTransaction.Dispose()
2007-03-09 17:50:00,391 [7] DEBUG ca.bc.gov.cserv.frameworks.dataaccess.NHibernateHelper - CloseSession Start
2007-03-09 17:50:00,391 [7] DEBUG NHibernate.Impl.SessionImpl - closing session
2007-03-09 17:50:00,391 [7] DEBUG NHibernate.Impl.SessionImpl - disconnecting session
2007-03-09 17:50:00,391 [7] DEBUG NHibernate.Connection.ConnectionProvider - Closing connection
2007-03-09 17:50:00,391 [7] DEBUG NHibernate.Impl.SessionImpl - transaction completion
2007-03-09 17:50:00,391 [7] DEBUG ca.bc.gov.cserv.frameworks.dataaccess.NHibernateHelper - CloseSession End
2007-03-09 17:50:00,391 [7] DEBUG ca.bc.gov.cserv.frameworks.dataaccess.NHibernateHelper - Update End