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 6058921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:39:12+00:00 2026-05-23T08:39:12+00:00

My Oracle database has a sequence (PART_SEQ) starting at 1,000,000,000. My NHibernate mapping uses

  • 0

My Oracle database has a sequence (PART_SEQ) starting at 1,000,000,000. My NHibernate mapping uses this sequence for id generation using seqhilo.

  <id name="_persistenceId" column="Id" type="long" access="field" unsaved-value="0" >
     <generator class="seqhilo" >
        <param name="sequence">part_seq</param>
        <param name="max_lo">100</param>
     </generator>
  </id>

I am expecting ids to be generated like 100000000000, 100000000001, 100000000002, …, 100000000100, 100000000101, 100000000102, … based on this question and this question.

Instead NHibernate is producing ids like 101000000000, 101000000001, 101000000002, …, 101000000100, 101000000101, 101000000102 with an extra 1. How is it producing these ids and how can I get it to not add the extra 1 to the id?

  • 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-23T08:39:13+00:00Added an answer on May 23, 2026 at 8:39 am

    Looking at the source here, the implementation of the algorithm adds 1 to the max_lo value before multiplying it by the sequence to generate the hi part. The lo part is then added to this result to create the final id.

    For the example in the question it will produce ids in the following manner:

    //max_lo is set to 100 when the generator is initialized
    
    if(lo > max_lo)
    {
        lo = 1;
        sequence = GetNextSequenceNumber(...);  //Starts at 1 billion
        hi = sequence * (max_lo + 1);
    }
    returnVal = hi + lo++;
    

    Creating 101000000001, 101000000002, 101000000003, etc.

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

Sidebar

Related Questions

I am using Fluent NHibernate on a project that has an Oracle 10g database.
Oracle has this concept of allowing database users to be identified by the operating
The app my colleagues and I maintain has an Oracle database at the back-end.
I'm using an Oracle database with a collation different to my OS language. I'm
We are using an oracle database in a project. Most of the tables represents
Table has surrogate primary key generated from sequence. Unfortunately, this sequence is used for
In an organization that has two applications each with its own Oracle database instance,
I am using oracle database. If have a large transaction to make (700 tables,
Possible Duplicate: How to add a UTF-8 BOM in java My oracle database has
I have an Oracle database column, say col1, that has the following values: Col1

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.