-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: No changes but hibernate is updating tables.
PostPosted: Tue Apr 04, 2006 7:36 pm 
Newbie

Joined: Mon Apr 03, 2006 1:38 am
Posts: 11
Hi,

Does anyone know why the following is occuring?

1)
I'm using criteria to get a list of objects out of my database for reading purposes only. At the moment I am not doing anything with the returned list from criteria.List(). Yet when I commit the transaction (I'm using the open session per view pattern) nhibernate is performing a batch update. I don't understand why since nothing at all has changed. The criteria.List() operation is the only operation I am performing in this transaction.

2)
When nhibernate does this batch update I am getting an error to do with dates. The object has a valid System.DateTime value set (Note: I did not set this it was set by nhibernate when it was pulled from the database). Yet I get the following:

SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.

Source Error:


Line 91: Catch ex As HibernateException
Line 92: RollbackTransaction()
Line 93: Throw ex
Line 94: End Try
Line 95:


Source File: C:\projects\EventHorizon\DATAACCESSCORE\NHibernateSessionManager.vb Line: 93

Stack Trace:


[SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.]
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
NHibernate.Impl.BatcherImpl.ExecuteNonQuery(IDbCommand cmd)
NHibernate.Impl.NonBatchingBatcher.AddToBatch(Int32 expectedRowCount)
NHibernate.Persister.EntityPersister.Update(Object id, Object[] fields, Object[] oldFields, Boolean[] includeProperty, Object oldVersion, Object obj, SqlString sqlUpdateString, ISessionImplementor session)

[ADOException: could not update: [EHClasses.Modules.IA.Model.EstateItem#1437]]
EHClasses.DataAccessCore.NHibernateSessionManager.CommitTransaction() in C:\projects\EventHorizon\DATAACCESSCORE\NHibernateSessionManager.vb:93
EHClasses.DataAccessCore.NHibernateSessionModule.CommitAndCloseSession(Object sender, EventArgs e) in C:\projects\EventHorizon\DATAACCESSCORE\NHibernateSessionModule.vb:22
System.Web.SyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 8:09 pm 
Newbie

Joined: Mon Apr 03, 2006 1:38 am
Posts: 11
This solved it:

http://wiki.nhibernate.org/display/NHC/Nullables

and this explained why the unnecessary updating was occuring:

http://jira.nhibernate.org/browse/NH-446


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.