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

HELP! I just setup a virtual host for two sites that have a lot
I have just inherited a server application, however it seems that the only copy
I have just got a MacBook Pro and have been using it (+Fusion) to
I have just discovered that I don't think my nhibernate setup seems to be
I'm simply trying to get data from two sql server db tables using ado.net
I have just set up cruise control.net on our build server, and I am
Have just started using Google Chrome , and noticed in parts of our site,
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I have just started using silverlight 2 beta and cannot find how to or
I have just started using Boost 1.36. These libraries would be very useful in

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.