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
  • 1 View
  • 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

Related Questions

I'm using Fluent NHibernate auto mapping. I need to access more than one database
Currently I'm using Fluent NHibernate to generate my database schema, but I want the
I have a WPF Application using Fluent NHibernate 1.0 RTM and System.Data.SQLite 1.0.65 that
I'm using SQLite ( system.data.sqlite v. 1.0.60.0 ) on a Fluent NHibernate project. I
Just started developing a project using NHibernate and Fluent NHibernate for the mapping and
How to load complete object (that has all asociated objects within) using Fluent NHibernate?
I'm moving a project from SubSonic to NHibernate and am using Fluent NHibernate to
I'm using Fluent NHibernate (Auto Mapping) to map my domain objects to database tables.
I've just modelled a small database using Fluent nHibernate and the auto mapping feature.
I've just finished setting up a project using MVC 3, Fluent nHibernate, AutoMapper, and

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.