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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:01:06+00:00 2026-05-13T07:01:06+00:00

Using a Join and Component together in Fluent NHibernate Mapping throws Could not find

  • 0

Using a Join and Component together in Fluent NHibernate Mapping throws “Could not find a getter for property exception”. This is my C# code

using FluentNHibernate.Mapping;

namespace FnhTest {
    public class CustomerMap : ClassMap<Customer> {
        public CustomerMap() {
            Id(x => x.Id).GeneratedBy.Identity();
            Map(x => x.Name);

            Join("BillingInfo", m =>
                               {
                                   m.KeyColumn("CustomerId");
                                   m.Component(x => x.BillingInfo, c =>
                                                                   {
                                                                       c.Map(y => y.AccountNumber);
                                                                       c.Map(y => y.Address);
                                                                   });
                               });
        }
    }

    public class BillingInfo {
        public virtual string AccountNumber { get; set; }
        public virtual string Address { get; set; }
    }

    public class Customer {
        public virtual int Id { get; set; }
        public virtual string Name { get; set; }

        public virtual BillingInfo BillingInfo { get; set; }
    }
}

And this is my Database structure =>

Customers:
  Id (int)
  Name (varchar 50)
BillingInfo:
  Id (int)
  AccountNumber (varchar 50)
  Address (varchar 50)
  CustomerId (int) (Foriegn Key to the Customers Id)

Fluent NHibernate generates the right mapping for this setup, but for some reason it throws up an error. Given below are the mapping and the error

Mapping:

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-access="property" auto-import="true" default-cascade="none" default-lazy="true">
  <class xmlns="urn:nhibernate-mapping-2.2" name="FnhTest.Customer, FnhTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" table="`Customer`">
    <id name="Id" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <column name="Id" />
      <generator class="identity" />
    </id>
    <property name="Name" type="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <column name="Name" />
    </property>
    <join table="BillingInfo">
      <key>
        <column name="CustomerId" />
      </key>
      <component name="BillingInfo" insert="true" update="true" optimistic-lock="true">
        <property name="AccountNumber" type="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          <column name="AccountNumber" />
        </property>
        <property name="Address" type="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          <column name="Address" />
        </property>
      </component>
    </join>
  </class>
</hibernate-mapping>

Error:

TestCase 'M:FnhTest.Program.Main(System.String[])'
failed: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.

  * Database was not configured through Database method.

    FluentNHibernate.Cfg.FluentConfigurationException: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.

      * Database was not configured through Database method.
     ---> NHibernate.PropertyNotFoundException: Could not find a getter for property 'AccountNumber' in class 'FnhTest.Customer'
    at NHibernate.Properties.BasicPropertyAccessor.GetGetter(Type type, String propertyName)
    at NHibernate.Tuple.Component.PocoComponentTuplizer.BuildGetter(Component component, Property prop)
    at NHibernate.Tuple.Component.AbstractComponentTuplizer..ctor(Component component)
    at NHibernate.Tuple.Component.PocoComponentTuplizer..ctor(Component component)
    at NHibernate.Tuple.Component.ComponentEntityModeToTuplizerMapping..ctor(Component component)
    at NHibernate.Tuple.Component.ComponentMetamodel..ctor(Component component)
    at NHibernate.Mapping.Component.BuildType()
    at NHibernate.Mapping.Component.get_Type()
    at NHibernate.Mapping.SimpleValue.IsValid(IMapping mapping)
    at NHibernate.Mapping.PersistentClass.Validate(IMapping mapping)
    at NHibernate.Mapping.RootClass.Validate(IMapping mapping)
    at NHibernate.Cfg.Configuration.Validate()
    at NHibernate.Cfg.Configuration.BuildSessionFactory()
    d:\Builds\FluentNH\src\FluentNHibernate\Cfg\FluentConfiguration.cs(93,0): at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
       --- End of inner exception stack trace ---
    d:\Builds\FluentNH\src\FluentNHibernate\Cfg\FluentConfiguration.cs(100,0): at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
    D:\repositories\core\playground\minhajuddin\FnhTest\FnhTest\Program.cs(8,0): at FnhTest.Program.Main(String[] args)

      * Database was not configured through Database method.


0 passed, 1 failed, 0 skipped, took 6.46 seconds (Ad hoc).

I’ve searched all over the web but was unable to find anything helpful, Any kind of help would be greatly appreciated 🙂

EDIT:
Well, I didn’t find a way to do this in Fluent NHibernate, I am using whatever Torkel has posted as an answer. But, that was not my intention. Anyway.

  • 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-13T07:01:07+00:00Added an answer on May 13, 2026 at 7:01 am

    BillingInfo looks to me not like a component but an entity.

    If you map BillingInfo as an entity you can map it from Customer as a association.

    <many-to-one name="BillingInfo" property-ref="CustomerId" cascade="none"/>
    

    The property-ref is importand as you do not want to join on on the BillingInfo Id but on the CustomerId, this however requires you to add a CustomerId property to your BillingInfo class.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I would create a new throw-away tablespace in your test… May 13, 2026 at 8:10 pm
  • Editorial Team
    Editorial Team added an answer Because they are in normal flow. You would need to… May 13, 2026 at 8:10 pm
  • Editorial Team
    Editorial Team added an answer Try with oncommand="sayHello('hello')" May 13, 2026 at 8:10 pm

Related Questions

When creating a new System.Thread instance the default value of IsBackground is false. Can
I want to update TableA with values from TableB on a nightly basis. Right
Regarding In App Purchases, I can find a lot of information on all the
Just wondering how many people use a path module in Python such as Jason
I've been working with databases for the last few years and I'd like to

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.