Этот код выдает " Ошибка арифметического переполнения при преобразовании числового значения в тип данных числовой "
Session.Save(new Keyword
{
Approved = true,
Custom = false,
Value = "toto",
Language = "en"
});
Отображение ключевого слова следующее1009 *
public class KeywordMap : ClassMap<Keyword>
{
public KeywordMap()
{
Table("PRODUCTS_Keywords");
Id(x => x.Id, "keywordID").GeneratedBy.Identity();
Map(x => x.Value, "keyword")
.Not.Nullable();
Map(x => x.Language, "language")
.Not.Nullable();
Map(x => x.Approved, "approved")
.Not.Nullable();
Map(x => x.Custom, "custom")
.Not.Nullable();
}
}
Сущность ключевого слова следующая
public class Keyword
{
public virtual Int64 Id { get; private set; }
public virtual string Value { get; set; }
public virtual string Language { get; set; }
public virtual bool Approved { get; set; }
public virtual bool Custom { get; set; }
}
Это представление таблицы PRODUCTS_Keyword в моей базе данных (я использую MSSQL2008 R2)
CREATE TABLE [dbo].[PRODUCTS_Keywords](
[keywordID] [bigint] IDENTITY(1,1) NOT NULL,
[keyword] [nvarchar](50) NOT NULL,
[language] [char](2) NOT NULL,
[approved] [bit] NOT NULL,
[custom] [bit] NOT NULL,
PRIMARY KEY CLUSTERED
Это экспортированное отображение для ключевого слова
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-access="property" auto-import="true" default-cascade="none" default-lazy="true">
<class xmlns="urn:nhibernate-mapping-2.2" name="Keyword, Main, Version=1.4.0.0, Culture=neutral, PublicKeyToken=null" table="PRODUCTS_Keywords">
<id name="Id" type="System.Int64, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<column name="keywordID" />
<generator class="identity" />
</id>
<property name="Value" type="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<column name="keyword" not-null="true" />
</property>
<property name="Language" type="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<column name="language" not-null="true" />
</property>
<property name="Approved" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<column name="approved" not-null="true" />
</property>
<property name="Custom" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<column name="custom" not-null="true" />
</property>
</class>
</hibernate-mapping>
Это трассировка стека
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.AdoNet.AbstractBatcher.OnPreparedCommand()
at NHibernate.AdoNet.AbstractBatcher.PrepareCommand(CommandType type, SqlString sql, SqlType[] parameterTypes)
at NHibernate.AdoNet.AbstractBatcher.PrepareBatchCommand(CommandType type, SqlString sql, SqlType[] parameterTypes)
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, Int32 j, SqlCommandInfo sql, Object obj, ISessionImplementor session)
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Object obj, ISessionImplementor session)
at NHibernate.Action.EntityInsertAction.Execute()
at NHibernate.Engine.ActionQueue.Execute(IExecutable executable)
at NHibernate.Engine.ActionQueue.ExecuteActions(IList list)
at NHibernate.Engine.ActionQueue.ExecuteInserts()
at NHibernate.Event.Default.AbstractSaveEventListener.PerformSaveOrReplicate(Object entity, EntityKey key, IEntityPersister persister, Boolean useIdentityColumn, Object anything, IEventSource source, Boolean requiresImmediateIdAccess)
at NHibernate.Event.Default.AbstractSaveEventListener.PerformSave(Object entity, Object id, IEntityPersister persister, Boolean useIdentityColumn, Object anything, IEventSource source, Boolean requiresImmediateIdAccess)
at NHibernate.Event.Default.AbstractSaveEventListener.SaveWithGeneratedId(Object entity, String entityName, Object anything, IEventSource source, Boolean requiresImmediateIdAccess)
at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event)
at NHibernate.Event.Default.DefaultSaveEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event)
at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient(SaveOrUpdateEvent event)
at NHibernate.Event.Default.DefaultSaveEventListener.PerformSaveOrUpdate(SaveOrUpdateEvent event)
at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(SaveOrUpdateEvent event)
at NHibernate.Impl.SessionImpl.FireSave(SaveOrUpdateEvent event)
at NHibernate.Impl.SessionImpl.Save(Object obj)
В настоящее время в таблице PRODUCTS_Keywords имеется 266 016 записей, а максимальное значение (keywordID) составляет 8 942 223
В чем причина проблемы и как я могу ее устранитьэто?
Спасибо