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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:14:20+00:00 2026-05-31T17:14:20+00:00

I have a problem with nhibernate mapping. I use the nhibernate 3.2 mapping by

  • 0

I have a problem with nhibernate mapping. I use the nhibernate 3.2 mapping by code with that code

namespace NhibernateLiaisonBase
{
    [Serializable]
    public class Cessions
    {
        #region Public Properties
        public virtual int IdCessions
        {
            get;
            set;
        }

        public virtual DateTime CessionsDate
        {
            get;
            set;
        }
    #endregion
    }

    public class CessionsMap : ClassMapping<Cessions>
    {
        public CessionsMap()
        {
            Id<int>(x => x.IdCessions, map => map.Column("SCES_ID"));
            Property<DateTime>(x => x.CessionsDate, map => map.Column("SCES_DATE"));
            Table("SCES_CESSIONS");
        }
   }
}

and

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate.Mapping.ByCode.Conformist;

namespace NhibernateLiaisonBase
{
    [Serializable]
    public class CessionsLignes
    {
        #region Public Properties
        public virtual int IdCessionsLignes
        {
            get;
            set;
        }

    public virtual int QuantiteCessionsLignes
    {
        get;
        set;
    }

    public virtual Cessions cessions
    {
        get;
        set;
    }
    #endregion
}

    public class CessionsLignesMap : ClassMapping<CessionsLignes>
    {
        public CessionsLignesMap()
        {
            Id<int>(x => x.IdCessionsLignes, map =>
            {
                map.Generator(NHibernate.Mapping.ByCode.Generators.Identity);
            });
            Property<int>(x => x.QuantiteCessionsLignes, map => map.Column("SCESL_QTE"));
            ManyToOne<Cessions>(x => x.cessions, map => map.Column("SCESL_SCESID"));
            Table("SCESL_CESSIONSLIGNES");
        }
    }
}

When I use it rename the SCESL_SCESID column to IdCessionsLignes in the SCESL_CESSIONSLIGNES table. I generated the hbm.xml file, the result are : (first

<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" namespace="NhibernateLiaisonBase" assembly="NhibernateLiaisonBase" xmlns="urn:nhibernate-mapping-2.2">
  <class name="Cessions" table="SCES_CESSIONS">
    <id name="IdCessions" column="SCES_ID" type="Int32" />
    <property name="CessionsDate" column="SCES_DATE" />
  </class>
</hibernate-mapping>

and

<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" namespace="NhibernateLiaisonBase" assembly="NhibernateLiaisonBase" xmlns="urn:nhibernate-mapping-2.2">
  <class name="CessionsLignes" table="SCESL_CESSIONSLIGNES">
    <id name="IdCessionsLignes" type="Int32">
      <generator class="identity" />
    </id>
    <property name="QuantiteCessionsLignes" column="SCESL_QTE" />
    <many-to-one name="cessions" column="SCESL_SCESID" />
  </class>
</hibernate-mapping>

any idea ?

  • 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-31T17:14:21+00:00Added an answer on May 31, 2026 at 5:14 pm

    I think you forgot the call to Column in your identity map:

    Id<int>(x => x.IdCessionsLignes, map =>
    {
        map.Column("SCESL_SCESID")
           .Generator(NHibernate.Mapping.ByCode.Generators.Identity);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class that is mapped to a table using NHibernate. The problem
I have a problem in that I have switched my (working) multiple-database nhibernate solution
Hi i have a problem with mapping in Nhibernate. When I run a linq
I have a problem with: NHibernate.Cfg.Configuration.SetProperties() Not accepting the IDictionary: NHibernateConfigHandler I get the
I have a problem using Linq to NHibernate to load an object and eagerly
I have a very weird problem: sometimes when I call nHibernate update to an
I have a nHibernate query like this ICriteria query = session.CreateCriteria(typeof(MyResult)) .Add(Expression.Eq(ResultTypeId, myResult.ResultTypeId)) Problem
I have a problem with a query using hibernate. The entity class EntityClass has
I have problem in some JavaScript that I am writing where the Switch statement
I have started to use NHibernate 3.0 and PostgreSQL for a small project, so

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.