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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:40:13+00:00 2026-05-13T00:40:13+00:00

I am using Fluent NHibernate on a project that has an Oracle 10g database.

  • 0

I am using Fluent NHibernate on a project that has an Oracle 10g database. I am also using SQLite with a schema generated from my mapping for testing. The problem I am having is that, since the primary keys on my tables are generated by Oracle Sequences, to get my Add methods to work correctly I had to add .GeneratedBy.Sequence({sequence name}) to the Id field of each of my mappings so that the mappings look something like this:

public CustomerMap()
{
    Id(x => x.Id)
    .Column("Cust_Id")
    .GeneratedBy.Sequence("SEQ_CONTNT_AREA");
    ...
    {More Mapping Code}
    ...
}

Once I added the GeneratedBy.Sequece to my mappings all of my tests began to fail giving me the following errors:

----> NHibernate.MappingException : could not instantiate id generator
----> NHibernate.MappingException : Dialect does not support sequences

These errors make sense to me since SQLite does not use Oracle Sequences for Primary Key generation. However, if I change my mapping to use GeneratedBy.Native(), all of my tests pass, but when I run the application I get the following error when trying to insert a new record:

InnerException = {System.Data.OracleClient.OracleException: ORA-02289: sequence does not exist
    at System.Data.OracleClient.OracleConnection.CheckError(OciErrorHandle errorHandle, Int32 rc)
    at System.Data.OracleClient.OracleCommand.Execute(OciStatementHandle stateme...

Message: "could not get next sequence value[SQL: select hibernate_sequence.nextval from dual]"  string

This error message indicates to me that NHibernate either couldn’t find the sequence needed to create the primary key for this table or it didn’t even look for it. In either case, it appears to be trying to use ‘hibernate_sequence’ to get the value which it obviously cannot find since it doesn’t exist.

I figure I’m probably missing something pretty simple due to my being pretty new to NHibernate. It is pretty important that I get both the tests and code working soon, as I will be handing this project over to someone else who as even less NHibernate experience than I do when I leave for my new job next week.

  • 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-13T00:40:13+00:00Added an answer on May 13, 2026 at 12:40 am

    I know this is a huge hack, but could you do something like this?

    public CustomerMap()
    {
        if (SomeStaticClass.IsRunningUnitTests)
        {
            Id(x => x.Id)
            .Column("Cust_Id")
            .GeneratedBy.Native();
        }
        else
        {
            Id(x => x.Id)
            .Column("Cust_Id")
            .GeneratedBy.Sequence("SEQ_CONTNT_AREA");
        }
    
        ...
        {More Mapping Code}
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 268k
  • Answers 268k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It depends entirely on whether you specify CLONE_THREAD to the… May 13, 2026 at 1:09 pm
  • Editorial Team
    Editorial Team added an answer As long as you just do Debug builds I suppose… May 13, 2026 at 1:09 pm
  • Editorial Team
    Editorial Team added an answer There are 2 major problems with your code: t is… May 13, 2026 at 1:09 pm

Related Questions

How would you test this scenario? I've just started looking into NHibernate and having
I'm having a problem with a pretty simple setup in NHibernate. (I'm using Fluent
I have a feeling this is a dumb question I should have been able
We have been having this issue pop up sporadically, but now I can reproduce

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.