Hello !
I have strange problem wiht hilo generator on MS SQL 2005 Database.
Here is mapping file:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="OTP.BLL" namespace="OTP.BLL.Reports" auto-import="false">
<class name="OTP.BLL.Reports.ApplicationState"
table="Reports_ApplicationState">
<id name="Id" column="ID" type="Int64" unsaved-value="0">
<generator class="hilo">
<param name="column">next_hi_reportAppState</param>
</generator>
</id>
<property name="AppId" column="ApplicationId"/>
<property name="UserId" column="UserId"/>
<property name="State" column="`State`"/>
<property name="Status" column="`Status`"/>
<property name="Time" column="`Time`"/>
</class>
</hibernate-mapping>
The problem is with inserts - sometimes it fails with exception:
2009-09-02 10:32:11,435 [12] ERROR appid = 334 SecAppId = (null)
UserId = (null) NHibernate.Event.Default.AbstractFlushingEventListener
Could not synchronize database state with session
NHibernate.HibernateException: An exception occurred when executing
batch queries ---> System.Data.SqlClient.SqlException: Violation of
PRIMARY KEY constraint 'PK_Reports_ApplicationState'. Cannot insert
duplicate key in object 'dbo.Reports_ApplicationState'.
The statement has been terminated.
at System.Data.SqlClient.SqlConnection.OnError(SqlException
exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning
(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader
(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds
(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean
returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader
(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean
returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery
(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at System.Data.SqlClient.SqlCommand.ExecuteBatchRPCCommand()
at System.Data.SqlClient.SqlCommandSet.ExecuteNonQuery()
at NHibernate.AdoNet.SqlClientSqlCommandSet.ExecuteNonQuery()
--- End of inner exception stack trace ---
at NHibernate.AdoNet.SqlClientSqlCommandSet.ExecuteNonQuery()
at NHibernate.AdoNet.SqlClientBatchingBatcher.DoExecuteBatch
(IDbCommand ps)
at NHibernate.AdoNet.AbstractBatcher.ExecuteBatchWithTiming
(IDbCommand ps)
at NHibernate.AdoNet.AbstractBatcher.ExecuteBatch()
at NHibernate.Engine.ActionQueue.ExecuteActions(IList list)
at NHibernate.Engine.ActionQueue.ExecuteActions()
at
NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions
(IEventSource session)
Insert happens in sereral threads, and the database is with turned on
option read_committed_snapshot. Is HiLo compatible with this option ?
When read_committed_snapshot was turned off, everything was ok.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---