2010-09-09 56 views
1

我使用NHibernate的屬性產生這種...NHibernate的嘗試更新,而不是插入一個新的對象

<class name="xxx.Message.MtMessage, xxx" lazy="false" table="tblCore_MtMessage"> 
    <id name="MtMessageId"> 
     <generator class="identity" /> 
    </id> 
    <property name="MtMessageStatus" /> 
    <property name="ApplicationMessageId" /> 
    <property name="IsPremium" /> 
    <property name="Tariff" /> 
    <property name="ExpiryTimeMinutes" /> 
    <property name="PhoneNetwork" /> 
    <property name="MessageText" /> 
    <property name="ToNumber" /> 
    <property name="FromNumber" /> 
    <property name="IsCompleted" /> 
    <property name="UpdateDate" /> 
    <many-to-one name="Category" class="xxx.Category, xxx" column="CategoryId" not-null="true" cascade="None" /> 
    <many-to-one name="Aggregator" class="xxx.AbstractAggregator, xxx" column="AggregatorId" cascade="None" /> 
    <many-to-one name="Aggregator" class="xxx.AbstractAggregator, xxx" column="AggregatorId" cascade="None" /> 
    <many-to-one name="Application" class="xxx.Application, xxx" column="ApplicationId" cascade="None" /> 
    <many-to-one name="Application" class="xxx.Application, xxx" column="ApplicationId" cascade="None" /> 
    <bag name="Segments" lazy="false" inverse="true" cascade="None"> 
     <key column="MtMessageId" /> 
     <one-to-many class="xxx.Message.MtSegment, xxx" /> 
    </bag> 
    </class> 

    <class name="xxx.Message.MoMessage, xxx" lazy="false" table="tblCore_MoMessage"> 
    <id name="MoMessageId"> 
     <generator class="identity" /> 
    </id> 
    <property name="MoMessageStatus" /> 
    <property name="PhoneNetwork" /> 
    <property name="MessageText" /> 
    <property name="ToNumber" /> 
    <property name="FromNumber" /> 
    <property name="IsCompleted" /> 
    <property name="UpdateDate" /> 
    <list name="Segments" lazy="false" inverse="true" cascade="None"> 
     <key column="MoMessageId" /> 
     <index column="SegmentNumber" /> 
     <one-to-many class="xxx.Message.MoSegment, xxx" /> 
    </list> 
    </class> 

出於某種原因,當我創建一個新的MoMessage並調用ISession.Save()就可以了nHibernate嘗試更新而不是INSERT。我沒有問題保存MtMessage。我試圖改變一個包的列表,因爲這是唯一真正的區別,那是行不通的。任何人有任何指針開始尋找?

這裏有記錄的大,可以幫助

2010-09-09 18:53:54,015 DEBUG xxx.NHibernate.ReceiveMoUow - Saving message[Id:0,Type:MO,To:89000,From:447000000000,Network:O2,Status:New,Text:Hi mum] 
2010-09-09 18:53:54,031 DEBUG xxx.Persist.NHibernateConnection - CreateSession(Commit) 
2010-09-09 18:53:54,031 DEBUG NHibernate.Impl.SessionImpl - [session-id=408ca207-0ed1-487f-b57b-ae6a072a4d3f] opened session at timestamp: 634196552340, for session factory: [/0754517161044239b072f9d048fcb17f] 
2010-09-09 18:53:54,031 DEBUG NHibernate.Loader.Criteria.CriteriaQueryTranslator - put criteria=PhoneNumber = 447000000000 and IsEnabled = True alias=this0_ 
2010-09-09 18:53:54,031 DEBUG NHibernate.Loader.Criteria.CriteriaQueryTranslator - returning alias=this_ for criteria=PhoneNumber = 447000000000 and IsEnabled = True 
2010-09-09 18:53:54,031 DEBUG NHibernate.Loader.Criteria.CriteriaQueryTranslator - returning alias=this_ for criteria=PhoneNumber = 447000000000 and IsEnabled = True 
2010-09-09 18:53:54,031 DEBUG NHibernate.Loader.Criteria.CriteriaQueryTranslator - getCriteria for path=Application crit= 
2010-09-09 18:53:54,031 DEBUG NHibernate.Loader.Criteria.CriteriaQueryTranslator - getCriteria for path=Application.RedirectApplication crit= 
2010-09-09 18:53:54,031 DEBUG NHibernate.SqlCommand.SqlSelectBuilder - The initial capacity was set too low at: 12 for the SelectSqlBuilder that needed a capacity of: 16 for the table dbo.tblCore_PhoneDiverts this_ 
2010-09-09 18:53:54,031 DEBUG NHibernate.AdoNet.AbstractBatcher - Opened new IDbCommand, open IDbCommands: 1 
2010-09-09 18:53:54,031 DEBUG NHibernate.AdoNet.AbstractBatcher - Building an IDbCommand object for the SqlString: SELECT this_.PhoneNumber as PhoneNum1_9_2_, this_.DivertName as DivertName9_2_, this_.IsEnabled as IsEnabled9_2_, this_.UpdateDate as UpdateDate9_2_, this_.ApplicationId as Applicat5_9_2_, applicatio2_.ApplicationId as Applicat1_3_0_, applicatio2_.ApplicationName as Applicat2_3_0_, applicatio2_.ValidationKey as Validati3_3_0_, applicatio2_.ApplicationWebInterfaceUrl as Applicat4_3_0_, applicatio2_.IpAddress as IpAddress3_0_, applicatio2_.ApplicationWebInterfaceVersion as Applicat6_3_0_, applicatio2_.ShouldSend as ShouldSend3_0_, applicatio2_.ShouldRedirect as ShouldRe8_3_0_, applicatio2_.ShouldDumpMessage as ShouldDu9_3_0_, applicatio2_.UpdateDate as UpdateDate3_0_, applicatio2_.RedirectApplicationId as Redirec11_3_0_, applicatio3_.ApplicationId as Applicat1_3_1_, applicatio3_.ApplicationName as Applicat2_3_1_, applicatio3_.ValidationKey as Validati3_3_1_, applicatio3_.ApplicationWebInterfaceUrl as Applicat4_3_1_, applicatio3_.IpAddress as IpAddress3_1_, applicatio3_.ApplicationWebInterfaceVersion as Applicat6_3_1_, applicatio3_.ShouldSend as ShouldSend3_1_, applicatio3_.ShouldRedirect as ShouldRe8_3_1_, applicatio3_.ShouldDumpMessage as ShouldDu9_3_1_, applicatio3_.UpdateDate as UpdateDate3_1_, applicatio3_.RedirectApplicationId as Redirec11_3_1_ FROM dbo.tblCore_PhoneDiverts this_ left outer join dbo.tblCore_Applications applicatio2_ on this_.ApplicationId=applicatio2_.ApplicationId left outer join dbo.tblCore_Applications applicatio3_ on applicatio2_.RedirectApplicationId=applicatio3_.ApplicationId WHERE this_.PhoneNumber = ? and this_.IsEnabled = ? 
2010-09-09 18:53:54,031 DEBUG NHibernate.Engine.QueryParameters - BindParameters(Named:NHibernate.Type.StringType) 447000000000 -> [0] 
2010-09-09 18:53:54,031 DEBUG NHibernate.Type.StringType - binding '447000000000' to parameter: 0 
2010-09-09 18:53:54,031 DEBUG NHibernate.Engine.QueryParameters - BindParameters(Named:NHibernate.Type.BooleanType) True -> [1] 
2010-09-09 18:53:54,031 DEBUG NHibernate.Type.BooleanType - binding 'True' to parameter: 1 
2010-09-09 18:53:54,031 INFO NHibernate.Loader.Loader - SELECT this_.PhoneNumber as PhoneNum1_9_2_, this_.DivertName as DivertName9_2_, this_.IsEnabled as IsEnabled9_2_, this_.UpdateDate as UpdateDate9_2_, this_.ApplicationId as Applicat5_9_2_, applicatio2_.ApplicationId as Applicat1_3_0_, applicatio2_.ApplicationName as Applicat2_3_0_, applicatio2_.ValidationKey as Validati3_3_0_, applicatio2_.ApplicationWebInterfaceUrl as Applicat4_3_0_, applicatio2_.IpAddress as IpAddress3_0_, applicatio2_.ApplicationWebInterfaceVersion as Applicat6_3_0_, applicatio2_.ShouldSend as ShouldSend3_0_, applicatio2_.ShouldRedirect as ShouldRe8_3_0_, applicatio2_.ShouldDumpMessage as ShouldDu9_3_0_, applicatio2_.UpdateDate as UpdateDate3_0_, applicatio2_.RedirectApplicationId as Redirec11_3_0_, applicatio3_.ApplicationId as Applicat1_3_1_, applicatio3_.ApplicationName as Applicat2_3_1_, applicatio3_.ValidationKey as Validati3_3_1_, applicatio3_.ApplicationWebInterfaceUrl as Applicat4_3_1_, applicatio3_.IpAddress as IpAddress3_1_, applicatio3_.ApplicationWebInterfaceVersion as Applicat6_3_1_, applicatio3_.ShouldSend as ShouldSend3_1_, applicatio3_.ShouldRedirect as ShouldRe8_3_1_, applicatio3_.ShouldDumpMessage as ShouldDu9_3_1_, applicatio3_.UpdateDate as UpdateDate3_1_, applicatio3_.RedirectApplicationId as Redirec11_3_1_ FROM dbo.tblCore_PhoneDiverts this_ left outer join dbo.tblCore_Applications applicatio2_ on this_.ApplicationId=applicatio2_.ApplicationId left outer join dbo.tblCore_Applications applicatio3_ on applicatio2_.RedirectApplicationId=applicatio3_.ApplicationId WHERE this_.PhoneNumber = @p0 and this_.IsEnabled = @p1 
2010-09-09 18:53:54,031 DEBUG NHibernate.SQL - SELECT this_.PhoneNumber as PhoneNum1_9_2_, this_.DivertName as DivertName9_2_, this_.IsEnabled as IsEnabled9_2_, this_.UpdateDate as UpdateDate9_2_, this_.ApplicationId as Applicat5_9_2_, applicatio2_.ApplicationId as Applicat1_3_0_, applicatio2_.ApplicationName as Applicat2_3_0_, applicatio2_.ValidationKey as Validati3_3_0_, applicatio2_.ApplicationWebInterfaceUrl as Applicat4_3_0_, applicatio2_.IpAddress as IpAddress3_0_, applicatio2_.ApplicationWebInterfaceVersion as Applicat6_3_0_, applicatio2_.ShouldSend as ShouldSend3_0_, applicatio2_.ShouldRedirect as ShouldRe8_3_0_, applicatio2_.ShouldDumpMessage as ShouldDu9_3_0_, applicatio2_.UpdateDate as UpdateDate3_0_, applicatio2_.RedirectApplicationId as Redirec11_3_0_, applicatio3_.ApplicationId as Applicat1_3_1_, applicatio3_.ApplicationName as Applicat2_3_1_, applicatio3_.ValidationKey as Validati3_3_1_, applicatio3_.ApplicationWebInterfaceUrl as Applicat4_3_1_, applicatio3_.IpAddress as IpAddress3_1_, applicatio3_.ApplicationWebInterfaceVersion as Applicat6_3_1_, applicatio3_.ShouldSend as ShouldSend3_1_, applicatio3_.ShouldRedirect as ShouldRe8_3_1_, applicatio3_.ShouldDumpMessage as ShouldDu9_3_1_, applicatio3_.UpdateDate as UpdateDate3_1_, applicatio3_.RedirectApplicationId as Redirec11_3_1_ FROM dbo.tblCore_PhoneDiverts this_ left outer join dbo.tblCore_Applications applicatio2_ on this_.ApplicationId=applicatio2_.ApplicationId left outer join dbo.tblCore_Applications applicatio3_ on applicatio2_.RedirectApplicationId=applicatio3_.ApplicationId WHERE this_.PhoneNumber = @p0 and this_.IsEnabled = @p1;@p0 = '447000000000', @p1 = True 
2010-09-09 18:53:54,031 DEBUG NHibernate.Connection.DriverConnectionProvider - Obtaining IDbConnection from Driver 
2010-09-09 18:53:54,031 DEBUG NHibernate.AdoNet.AbstractBatcher - ExecuteReader took 1 ms 
2010-09-09 18:53:54,031 DEBUG NHibernate.AdoNet.AbstractBatcher - Opened IDataReader, open IDataReaders: 1 
2010-09-09 18:53:54,031 DEBUG NHibernate.Loader.Loader - processing result set 
2010-09-09 18:53:54,031 DEBUG NHibernate.Loader.Loader - done processing result set (0 rows) 
2010-09-09 18:53:54,031 DEBUG NHibernate.Driver.NHybridDataReader - running NHybridDataReader.Dispose() 
2010-09-09 18:53:54,031 DEBUG NHibernate.AdoNet.AbstractBatcher - Closed IDataReader, open IDataReaders :0 
2010-09-09 18:53:54,031 DEBUG NHibernate.AdoNet.AbstractBatcher - DataReader was closed after 1 ms 
2010-09-09 18:53:54,031 DEBUG NHibernate.AdoNet.AbstractBatcher - Closed IDbCommand, open IDbCommands: 0 
2010-09-09 18:53:54,031 DEBUG NHibernate.AdoNet.ConnectionManager - aggressively releasing database connection 
2010-09-09 18:53:54,031 DEBUG NHibernate.Connection.ConnectionProvider - Closing connection 
2010-09-09 18:53:54,031 DEBUG NHibernate.Loader.Loader - total objects hydrated: 0 
2010-09-09 18:53:54,031 DEBUG NHibernate.Engine.StatefulPersistenceContext - initializing non-lazy collections 
2010-09-09 18:53:54,031 DEBUG NHibernate.AdoNet.ConnectionManager - after autocommit 
2010-09-09 18:53:54,031 DEBUG NHibernate.Impl.SessionImpl - transaction completion 
2010-09-09 18:53:54,031 DEBUG NHibernate.AdoNet.ConnectionManager - aggressively releasing database connection 
2010-09-09 18:53:54,031 DEBUG NHibernate.Impl.SessionImpl - [session-id=408ca207-0ed1-487f-b57b-ae6a072a4d3f] running ISession.Dispose() 
2010-09-09 18:53:54,031 DEBUG NHibernate.Impl.SessionImpl - [session-id=408ca207-0ed1-487f-b57b-ae6a072a4d3f] executing real Dispose(True) 
2010-09-09 18:53:54,031 DEBUG NHibernate.Impl.SessionImpl - closing session 
2010-09-09 18:53:54,031 DEBUG NHibernate.AdoNet.AbstractBatcher - running BatcherImpl.Dispose(true) 
2010-09-09 18:53:54,031 DEBUG xxx.Persist.NHibernateConnection - CreateSession(Commit) 
2010-09-09 18:53:54,031 DEBUG NHibernate.Impl.SessionImpl - [session-id=fce26533-bf6c-4f93-b75e-61a8c88c1e87] opened session at timestamp: 634196552340, for session factory: [/0754517161044239b072f9d048fcb17f] 
2010-09-09 18:53:54,031 DEBUG NHibernate.Loader.Criteria.CriteriaQueryTranslator - put criteria=PhoneNetwork = O2 and IsEnabled = True alias=this0_ 
2010-09-09 18:53:54,031 DEBUG NHibernate.Loader.Criteria.CriteriaQueryTranslator - returning alias=this_ for criteria=PhoneNetwork = O2 and IsEnabled = True 
2010-09-09 18:53:54,031 DEBUG NHibernate.Loader.Criteria.CriteriaQueryTranslator - returning alias=this_ for criteria=PhoneNetwork = O2 and IsEnabled = True 
2010-09-09 18:53:54,031 DEBUG NHibernate.Loader.Criteria.CriteriaQueryTranslator - getCriteria for path=Application crit= 
2010-09-09 18:53:54,031 DEBUG NHibernate.Loader.Criteria.CriteriaQueryTranslator - getCriteria for path=Application.RedirectApplication crit= 
2010-09-09 18:53:54,031 DEBUG NHibernate.SqlCommand.SqlSelectBuilder - The initial capacity was set too low at: 12 for the SelectSqlBuilder that needed a capacity of: 16 for the table dbo.tblCore_NetworkDiverts this_ 
2010-09-09 18:53:54,031 DEBUG NHibernate.AdoNet.AbstractBatcher - Opened new IDbCommand, open IDbCommands: 1 
2010-09-09 18:53:54,031 DEBUG NHibernate.AdoNet.AbstractBatcher - Building an IDbCommand object for the SqlString: SELECT this_.PhoneNetwork as PhoneNet1_13_2_, this_.IsEnabled as IsEnabled13_2_, this_.UpdateDate as UpdateDate13_2_, this_.ApplicationId as Applicat4_13_2_, applicatio2_.ApplicationId as Applicat1_3_0_, applicatio2_.ApplicationName as Applicat2_3_0_, applicatio2_.ValidationKey as Validati3_3_0_, applicatio2_.ApplicationWebInterfaceUrl as Applicat4_3_0_, applicatio2_.IpAddress as IpAddress3_0_, applicatio2_.ApplicationWebInterfaceVersion as Applicat6_3_0_, applicatio2_.ShouldSend as ShouldSend3_0_, applicatio2_.ShouldRedirect as ShouldRe8_3_0_, applicatio2_.ShouldDumpMessage as ShouldDu9_3_0_, applicatio2_.UpdateDate as UpdateDate3_0_, applicatio2_.RedirectApplicationId as Redirec11_3_0_, applicatio3_.ApplicationId as Applicat1_3_1_, applicatio3_.ApplicationName as Applicat2_3_1_, applicatio3_.ValidationKey as Validati3_3_1_, applicatio3_.ApplicationWebInterfaceUrl as Applicat4_3_1_, applicatio3_.IpAddress as IpAddress3_1_, applicatio3_.ApplicationWebInterfaceVersion as Applicat6_3_1_, applicatio3_.ShouldSend as ShouldSend3_1_, applicatio3_.ShouldRedirect as ShouldRe8_3_1_, applicatio3_.ShouldDumpMessage as ShouldDu9_3_1_, applicatio3_.UpdateDate as UpdateDate3_1_, applicatio3_.RedirectApplicationId as Redirec11_3_1_ FROM dbo.tblCore_NetworkDiverts this_ left outer join dbo.tblCore_Applications applicatio2_ on this_.ApplicationId=applicatio2_.ApplicationId left outer join dbo.tblCore_Applications applicatio3_ on applicatio2_.RedirectApplicationId=applicatio3_.ApplicationId WHERE this_.PhoneNetwork = ? and this_.IsEnabled = ? 
2010-09-09 18:53:54,031 DEBUG NHibernate.Engine.QueryParameters - BindParameters(Named:NHibernate.Type.PersistentEnumType) O2 -> [0] 
2010-09-09 18:53:54,031 DEBUG NHibernate.Type.PersistentEnumType - binding '0' to parameter: 0 
2010-09-09 18:53:54,031 DEBUG NHibernate.Engine.QueryParameters - BindParameters(Named:NHibernate.Type.BooleanType) True -> [1] 
2010-09-09 18:53:54,031 DEBUG NHibernate.Type.BooleanType - binding 'True' to parameter: 1 
2010-09-09 18:53:54,031 INFO NHibernate.Loader.Loader - SELECT this_.PhoneNetwork as PhoneNet1_13_2_, this_.IsEnabled as IsEnabled13_2_, this_.UpdateDate as UpdateDate13_2_, this_.ApplicationId as Applicat4_13_2_, applicatio2_.ApplicationId as Applicat1_3_0_, applicatio2_.ApplicationName as Applicat2_3_0_, applicatio2_.ValidationKey as Validati3_3_0_, applicatio2_.ApplicationWebInterfaceUrl as Applicat4_3_0_, applicatio2_.IpAddress as IpAddress3_0_, applicatio2_.ApplicationWebInterfaceVersion as Applicat6_3_0_, applicatio2_.ShouldSend as ShouldSend3_0_, applicatio2_.ShouldRedirect as ShouldRe8_3_0_, applicatio2_.ShouldDumpMessage as ShouldDu9_3_0_, applicatio2_.UpdateDate as UpdateDate3_0_, applicatio2_.RedirectApplicationId as Redirec11_3_0_, applicatio3_.ApplicationId as Applicat1_3_1_, applicatio3_.ApplicationName as Applicat2_3_1_, applicatio3_.ValidationKey as Validati3_3_1_, applicatio3_.ApplicationWebInterfaceUrl as Applicat4_3_1_, applicatio3_.IpAddress as IpAddress3_1_, applicatio3_.ApplicationWebInterfaceVersion as Applicat6_3_1_, applicatio3_.ShouldSend as ShouldSend3_1_, applicatio3_.ShouldRedirect as ShouldRe8_3_1_, applicatio3_.ShouldDumpMessage as ShouldDu9_3_1_, applicatio3_.UpdateDate as UpdateDate3_1_, applicatio3_.RedirectApplicationId as Redirec11_3_1_ FROM dbo.tblCore_NetworkDiverts this_ left outer join dbo.tblCore_Applications applicatio2_ on this_.ApplicationId=applicatio2_.ApplicationId left outer join dbo.tblCore_Applications applicatio3_ on applicatio2_.RedirectApplicationId=applicatio3_.ApplicationId WHERE this_.PhoneNetwork = @p0 and this_.IsEnabled = @p1 
2010-09-09 18:53:54,031 DEBUG NHibernate.SQL - SELECT this_.PhoneNetwork as PhoneNet1_13_2_, this_.IsEnabled as IsEnabled13_2_, this_.UpdateDate as UpdateDate13_2_, this_.ApplicationId as Applicat4_13_2_, applicatio2_.ApplicationId as Applicat1_3_0_, applicatio2_.ApplicationName as Applicat2_3_0_, applicatio2_.ValidationKey as Validati3_3_0_, applicatio2_.ApplicationWebInterfaceUrl as Applicat4_3_0_, applicatio2_.IpAddress as IpAddress3_0_, applicatio2_.ApplicationWebInterfaceVersion as Applicat6_3_0_, applicatio2_.ShouldSend as ShouldSend3_0_, applicatio2_.ShouldRedirect as ShouldRe8_3_0_, applicatio2_.ShouldDumpMessage as ShouldDu9_3_0_, applicatio2_.UpdateDate as UpdateDate3_0_, applicatio2_.RedirectApplicationId as Redirec11_3_0_, applicatio3_.ApplicationId as Applicat1_3_1_, applicatio3_.ApplicationName as Applicat2_3_1_, applicatio3_.ValidationKey as Validati3_3_1_, applicatio3_.ApplicationWebInterfaceUrl as Applicat4_3_1_, applicatio3_.IpAddress as IpAddress3_1_, applicatio3_.ApplicationWebInterfaceVersion as Applicat6_3_1_, applicatio3_.ShouldSend as ShouldSend3_1_, applicatio3_.ShouldRedirect as ShouldRe8_3_1_, applicatio3_.ShouldDumpMessage as ShouldDu9_3_1_, applicatio3_.UpdateDate as UpdateDate3_1_, applicatio3_.RedirectApplicationId as Redirec11_3_1_ FROM dbo.tblCore_NetworkDiverts this_ left outer join dbo.tblCore_Applications applicatio2_ on this_.ApplicationId=applicatio2_.ApplicationId left outer join dbo.tblCore_Applications applicatio3_ on applicatio2_.RedirectApplicationId=applicatio3_.ApplicationId WHERE this_.PhoneNetwork = @p0 and this_.IsEnabled = @p1;@p0 = 0, @p1 = True 
2010-09-09 18:53:54,031 DEBUG NHibernate.Connection.DriverConnectionProvider - Obtaining IDbConnection from Driver 
2010-09-09 18:53:54,031 DEBUG NHibernate.AdoNet.AbstractBatcher - ExecuteReader took 0 ms 
2010-09-09 18:53:54,031 DEBUG NHibernate.AdoNet.AbstractBatcher - Opened IDataReader, open IDataReaders: 1 
2010-09-09 18:53:54,031 DEBUG NHibernate.Loader.Loader - processing result set 
2010-09-09 18:53:54,031 DEBUG NHibernate.Loader.Loader - done processing result set (0 rows) 
2010-09-09 18:53:54,031 DEBUG NHibernate.Driver.NHybridDataReader - running NHybridDataReader.Dispose() 
2010-09-09 18:53:54,031 DEBUG NHibernate.AdoNet.AbstractBatcher - Closed IDataReader, open IDataReaders :0 
2010-09-09 18:53:54,031 DEBUG NHibernate.AdoNet.AbstractBatcher - DataReader was closed after 1 ms 
2010-09-09 18:53:54,031 DEBUG NHibernate.AdoNet.AbstractBatcher - Closed IDbCommand, open IDbCommands: 0 
2010-09-09 18:53:54,031 DEBUG NHibernate.AdoNet.ConnectionManager - aggressively releasing database connection 
2010-09-09 18:53:54,031 DEBUG NHibernate.Connection.ConnectionProvider - Closing connection 
2010-09-09 18:53:54,031 DEBUG NHibernate.Loader.Loader - total objects hydrated: 0 
2010-09-09 18:53:54,031 DEBUG NHibernate.Engine.StatefulPersistenceContext - initializing non-lazy collections 
2010-09-09 18:53:54,031 DEBUG NHibernate.AdoNet.ConnectionManager - after autocommit 
2010-09-09 18:53:54,031 DEBUG NHibernate.Impl.SessionImpl - transaction completion 
2010-09-09 18:53:54,031 DEBUG NHibernate.AdoNet.ConnectionManager - aggressively releasing database connection 
2010-09-09 18:53:54,031 DEBUG NHibernate.Impl.SessionImpl - [session-id=fce26533-bf6c-4f93-b75e-61a8c88c1e87] running ISession.Dispose() 
2010-09-09 18:53:54,031 DEBUG NHibernate.Impl.SessionImpl - [session-id=fce26533-bf6c-4f93-b75e-61a8c88c1e87] executing real Dispose(True) 
2010-09-09 18:53:54,031 DEBUG NHibernate.Impl.SessionImpl - closing session 
2010-09-09 18:53:54,031 DEBUG NHibernate.AdoNet.AbstractBatcher - running BatcherImpl.Dispose(true) 
2010-09-09 18:53:54,046 DEBUG xxx.Persist.NHibernateConnection - CreateSession(Commit) 
2010-09-09 18:53:54,046 DEBUG NHibernate.Impl.SessionImpl - [session-id=d70b7e2f-062a-4495-83d0-380345acf920] opened session at timestamp: 634196552340, for session factory: [/0754517161044239b072f9d048fcb17f] 
2010-09-09 18:53:54,046 DEBUG NHibernate.Transaction.AdoTransaction - Begin (Unspecified) 
2010-09-09 18:53:54,046 DEBUG NHibernate.Connection.DriverConnectionProvider - Obtaining IDbConnection from Driver 
2010-09-09 18:53:54,062 DEBUG NHibernate.Event.Default.DefaultSaveOrUpdateEventListener - updating detached instance 
2010-09-09 18:53:54,078 DEBUG NHibernate.Event.Default.DefaultSaveOrUpdateEventListener - updating [xxx.Message.MoMessage#0] 
2010-09-09 18:53:54,093 DEBUG NHibernate.Event.Default.AbstractFlushingEventListener - collection dereferenced while transient [xxx.Message.MoMessage.Segments#0] 
2010-09-09 18:53:54,093 DEBUG NHibernate.Event.Default.DefaultSaveOrUpdateEventListener - updating [xxx.Message.MoMessage#0] 
2010-09-09 18:53:54,109 DEBUG NHibernate.Transaction.AdoTransaction - Start Commit 
2010-09-09 18:53:54,109 DEBUG NHibernate.Event.Default.AbstractFlushingEventListener - flushing session 
2010-09-09 18:53:54,140 DEBUG NHibernate.Event.Default.AbstractFlushingEventListener - processing flush-time cascades 
2010-09-09 18:53:54,140 DEBUG NHibernate.Event.Default.AbstractFlushingEventListener - dirty checking collections 
2010-09-09 18:53:54,140 DEBUG NHibernate.Event.Default.AbstractFlushingEventListener - Flushing entities and processing referenced collections 
2010-09-09 18:53:54,171 DEBUG NHibernate.Event.Default.WrapVisitor - Wrapped collection in role: xxx.Message.MoMessage.Segments 
2010-09-09 18:53:54,171 DEBUG NHibernate.Event.Default.DefaultFlushEntityEventListener - Updating entity: [xxx.Message.MoMessage#0] 
2010-09-09 18:53:54,187 DEBUG NHibernate.Engine.Collections - Collection found: [xxx.Message.MoMessage.Segments#0], was: [<unreferenced>] (initialized) 
2010-09-09 18:53:54,187 DEBUG NHibernate.Event.Default.AbstractFlushingEventListener - Processing unreferenced collections 
2010-09-09 18:53:54,187 DEBUG NHibernate.Event.Default.AbstractFlushingEventListener - Scheduling collection removes/(re)creates/updates 
2010-09-09 18:53:54,187 DEBUG NHibernate.Event.Default.AbstractFlushingEventListener - Flushed: 0 insertions, 1 updates, 0 deletions to 1 objects 
2010-09-09 18:53:54,187 DEBUG NHibernate.Event.Default.AbstractFlushingEventListener - Flushed: 1 (re)creations, 0 updates, 1 removals to 1 collections 
2010-09-09 18:53:54,203 DEBUG NHibernate.Impl.Printer - listing entities: 
2010-09-09 18:53:54,203 DEBUG NHibernate.Impl.Printer - xxx.Message.MoMessage{'MoMessageId'='0', 'MoMessageStatus'='52', 'PhoneNetwork'='0', 'MessageText'='Hi mum', 'ToNumber'='89000', 'FromNumber'='447000000000', 'IsCompleted'='True', 'UpdateDate'='09/09/2010 17:53:54', 'Aggregator'='xxx.AbstractAggregator#2', 'Application'='null', 'Segments'='['xxx.Message.MoSegment']'} 
2010-09-09 18:53:54,203 DEBUG NHibernate.Event.Default.AbstractFlushingEventListener - executing flush 
2010-09-09 18:53:54,203 DEBUG NHibernate.AdoNet.ConnectionManager - registering flush begin 
2010-09-09 18:53:54,218 DEBUG NHibernate.Persister.Entity.AbstractEntityPersister - Updating entity: [xxx.Message.MoMessage#0] 
2010-09-09 18:53:54,218 DEBUG NHibernate.AdoNet.AbstractBatcher - Opened new IDbCommand, open IDbCommands: 1 
2010-09-09 18:53:54,218 DEBUG NHibernate.AdoNet.AbstractBatcher - Building an IDbCommand object for the SqlString: UPDATE dbo.tblCore_MoMessage SET MoMessageStatus = ?, PhoneNetwork = ?, MessageText = ?, ToNumber = ?, FromNumber = ?, IsCompleted = ?, UpdateDate = ?, AggregatorId = ?, ApplicationId = ? WHERE MoMessageId = ? 
+0

你在問題文本中寫了「插入而不是更新」的錯誤方式rounf,這有點令人困惑。我還建議減少映射中的字段數量,直到找到仍然存在問題的最簡單的映射,這會讓您的問題更容易回答。 – 2010-09-09 22:20:47

+0

糟糕!謝謝,我已經換了他們。今天的任務是開始評論的東西,直到它的作品。事情是,MtMessage比MoMessage複雜得多,並且沒有問題。 – TedTrippin 2010-09-10 07:38:38

回答

0

的問題出現在我目前的一個內部被打開另一個會話。第二個/內部會話只加載一些Aggregator和Application對象。不知道爲什麼這會導致我的問題,我只能說不打開另一個會話,並加載其他對象已解決了最初的問題。

看起來像我將不得不使用外部會話來加載其他對象,但我現在有其他的東西要做。

相關問題