Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3624046
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:27:32+00:00 2026-05-18T23:27:32+00:00

I have just setup a Sql Server db using the same mappings and source

  • 0

I have just setup a Sql Server db using the same mappings and source data that have been working with SQLite, and getting the error below when I try to save a batch of test data.

I suspect it is a hilo issue that SQLite doesn’t catch but I can’t quite get my brain onto it. I am using the SchemaExport tool to generate the database, which creates a hibernate_unique_key table that is initially ‘1’. After the error it is ‘2’

Any suggestions?

Cheers,
Berryl

insert into hibernate_unique_key values ( 1 )

insert into hibernate_unique_key values ( 1 )

NHibernate: SELECT this_.ActivitySubjectId as Activity1_3_0_, this_.Description as Descript3_3_0_, 
this_.BusinessId as BusinessId3_0_, this_.ProjectCode as ProjectC6_3_0_ FROM ActivitySubjects this_ WHERE this_.ActivitySubjectType='PROJECT'

NHibernate: select next_hi from hibernate_unique_key with (updlock, rowlock)

NHibernate: update hibernate_unique_key set next_hi = @p0 where next_hi = @p1;@p0 = 2 [Type: Int32 (0)], @p1 = 1 [Type: Int32 (0)]

NHibernate: INSERT INTO ActivitySubjects (Description, BusinessId, ProjectCode, ActivitySubjectType, ActivitySubjectId) 
VALUES (@p0, @p1, @p2, 'PROJECT', @p3);@p0 = 'Refinish Casino Chairs' [Type: String (75)], @p1 = '006-00-023' [
Type: String (25)], @p2 = '006-00-023' [Type: String (4000)], @p3 = 32768 [Type: Int32 (0)]

NHibernate: INSERT INTO ActivitySubjects (Description, BusinessId, ProjectCode, ActivitySubjectType, 
ActivitySubjectId) VALUES (@p0, @p1, @p2, 'PROJECT', @p3);@p0 = 'Villa Garden Wall Enhancement' 
[Type: String (75)], @p1 = '006-00-024' [Type: String (25)], @p2 = '006-00-024' [Type: String (4000)], @p3 = 32769 [Type: Int32 (0)]

Test 'M:Smack.ConstructionAdmin.Data.Tests.DbConfiguration.TestData.SqlServerDataGenerator.CreateTestDataFile' failed: could not insert: 
[Smack.ConstructionAdmin.Domain.Activities.Subjects.Projects.Project#32769][SQL: INSERT INTO ActivitySubjects 
(Description, BusinessId, ProjectCode, ActivitySubjectType, ActivitySubjectId) VALUES (?, ?, ?, 'PROJECT', ?)]

NHibernate.Exceptions.GenericADOException: could not insert: 
[Smack.ConstructionAdmin.Domain.Activities.Subjects.Projects.Project#32769]
[SQL: INSERT INTO ActivitySubjects (Description, BusinessId, ProjectCode, ActivitySubjectType, 
    ActivitySubjectId) VALUES (?, ?, ?, 'PROJECT', ?)] 
    ---> System.Data.SqlClient.SqlException: Violation of UNIQUE KEY constraint 
        'UQ__ActivitySubjects__49555023'. Cannot insert duplicate key in object 'dbo.ActivitySubjects'.
The statement has been terminated.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T23:27:32+00:00Added an answer on May 18, 2026 at 11:27 pm

    The problem doesn’t appear to be with your hilo table. That is behaving correctly from my experience using hilo key generation. According to the exception, you’re violating a unique key constraint for ActivitySubjects. Check your unique key constraints.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just setup a new local site (localhost/pfb.net/) which has been cloned from
I have just setup a wordpress forum and I find that all images are
We have just setup our hudson server to build .NET projects which seems to
I have an app that I just got setup with a split view controller
Our setup I have a small hosting setup consisting of an SQL Server (2008),
I'm simply trying to get data from two sql server db tables using ado.net
Tables have been created in our SQL Server 2008 R2 database on a local server,
I have an SQL Server 2008 Database and am using C# 4.0 with Linq
I'm working on a Delphi/WIN32 application that uses an SQL Server database as back-end,
We have several SQL Server 2000 databases (I know, we need to upgrade) that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.