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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:43:03+00:00 2026-06-09T20:43:03+00:00

I am using fluent nhibernate with a legacy oracle db, and Devart Entity Developer

  • 0

I am using fluent nhibernate with a legacy oracle db, and Devart Entity Developer to generate mapping and entity classes.

I have a base table Product, which has several subclasses, including Tour. When saving Tour, nhibernate issues 2 identical inserts to the Product table which violates PK unique constraint.

Product mapping is:

public class ProductMap : ClassMap<Product>
{
    public ProductMap()
    {
        Schema("CT_PRODUCTS");
        Table("PRODUCT");
        OptimisticLock.None();
        LazyLoad();
        CompositeId()
            .KeyProperty(x => x.Season, set =>
            {
                set.Type("CT.DomainKernel.Enums.Season,CT.DomainKernel");
                set.ColumnName("SEASON");
                set.Access.Property();
            })
            .KeyProperty(x => x.ProductCode, set =>
            {
                set.ColumnName("PROD_CODE");
                set.Length(10);
                set.Access.Property();
            });
        Map(x => x.Name)
            .Column("NAME")
            .Access.Property()
            .Generated.Never()
            .CustomSqlType("VARCHAR2")
            .Length(200);
        HasOne(x => x.Tour)
            .Class<Tour>()
            .Access.Property()
            .Cascade.SaveUpdate()
            .LazyLoad();
    }
}

Tour mapping is:

public class TourMap : SubclassMap<Tour>
{
    public TourMap()
    {
        Schema("CT_PRODUCTS");
        Table("TOUR");
        LazyLoad();
        KeyColumn("SEASON");
        KeyColumn("PROD_CODE");
        Map(x => x.Duration)
            .Column("DURATION")
            .Access.Property()
            .Generated.Never()
            .CustomSqlType("NUMBER")
            .Not.Nullable()
            .Precision(3);
        HasOne(x => x.Product)
            .Class<Product>()
            .Access.Property()
            .Cascade.SaveUpdate()
            .LazyLoad()
            .Constrained();
    }
}

Tour Entity class:

public partial class Tour2 : Product
{
    public virtual Product Product
    {
        get
        {
            return this._Product;
        }
        set
        {
            this._Product = value;
        }
    }
}

Any Ideas as to what is going wrong?

  • 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-06-09T20:43:04+00:00Added an answer on June 9, 2026 at 8:43 pm

    The solution to this was to Remove the Property references from Tour to Product, and from Product to Tour, which when thought about, make no sense anyway.

    • 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, and auto-mapping the classes. I have a computed property in
I am using Fluent NHibernate and NHibernate.Core 3 beta 1. I have two classes:
I'm using Fluent NHibernate on Oracle and my problem is I have to apply
If using Fluent NHibernate, is it possible to automap most classes, but specify that
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
Can someone tell me how to accomplish this mapping using Fluent NHibernate? It's simply
I am using Fluent NHibernate's (1.0 RTM) automapping feature to create my oracle database
I have a Sharp Architecture based app using Fluent NHibernate with Automapping. I have

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.