我正在检查 NHibernate 的日志文件,发现随机错误,如下所示:
NHibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [MaltaIndependent.Modules._AutoGen.MemberImpl#353796206]
at NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Object[] oldFields, Object rowId, Boolean[] includeProperty, Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql, ISessionImplementor session) in c:\Repository\Work\CodeBase\C#\+OpenSource\nHibernate\nhibernate-core-master-v3.3.1\src\NHibernate\Persister\Entity\AbstractEntityPersister.cs:line 2821
at NHibernate.Persister.Entity.AbstractEntityPersister.UpdateOrInsert(Object id, Object[] fields, Object[] oldFields, Object rowId, Boolean[] includeProperty, Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql, ISessionImplementor session) in c:\Repository\Work\CodeBase\C#\+OpenSource\nHibernate\nhibernate-core-master-v3.3.1\src\NHibernate\Persister\Entity\AbstractEntityPersister.cs:line 2702
at NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Int32[] dirtyFields, Boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object obj, Object rowId, ISessionImplementor session) in c:\Repository\Work\CodeBase\C#\+OpenSource\nHibernate\nhibernate-core-master-v3.3.1\src\NHibernate\Persister\Entity\AbstractEntityPersister.cs:line 3007
at NHibernate.Action.EntityUpdateAction.Execute() in c:\Repository\Work\CodeBase\C#\+OpenSource\nHibernate\nhibernate-core-master-v3.3.1\src\NHibernate\Action\EntityUpdateAction.cs:line 79
at NHibernate.Engine.ActionQueue.Execute(IExecutable executable) in c:\Repository\Work\CodeBase\C#\+OpenSource\nHibernate\nhibernate-core-master-v3.3.1\src\NHibernate\Engine\ActionQueue.cs:line 136
at NHibernate.Engine.ActionQueue.ExecuteActions(IList list) in c:\Repository\Work\CodeBase\C#\+OpenSource\nHibernate\nhibernate-core-master-v3.3.1\src\NHibernate\Engine\ActionQueue.cs:line 125
at NHibernate.Engine.ActionQueue.ExecuteActions() in c:\Repository\Work\CodeBase\C#\+OpenSource\nHibernate\nhibernate-core-master-v3.3.1\src\NHibernate\Engine\ActionQueue.cs:line 171
at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session) in c:\Repository\Work\CodeBase\C#\+OpenSource\nHibernate\nhibernate-core-master-v3.3.1\src\NHibernate\Event\Default\AbstractFlushingEventListener.cs:line 241
关于这个问题,我知道这是由于乐观并发而发生的,并且“预计”会发生。我的主要问题是堆栈跟踪 - 它没有说明它发生在“哪里”,它开始了这一行NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecution
。我尝试下载 NHibernate 源代码并查看,但对于为什么没有显示完整的堆栈跟踪没有多大意义。我还有其他类似错误的堆栈跟踪,这些错误使我陷入Transaction.Commit()
困境。有什么想法可以找到实际上引发错误的代码吗?