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

  • Home
  • SEARCH
  • 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 344681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:00:47+00:00 2026-05-12T11:00:47+00:00

The story: I had class User and class Organization: User. I did not use

  • 0

The story:
I had class User and class Organization: User. I did not use any mappings for these classes, let FNH do mapping automatically. Then, I added

   public class OrganizationMap : IAutoMappingOverride<Organization>
   {
      public void Override(AutoMap<Organization> mapping)
      {
      }
   }

Notice there’re no overrides. So I did not expect any changes in FNH behavior. But I got this (during schema export actually):

NHibernate.MappingException:
(XmlDocument)(2,4): XML validation
error: The element ‘class’ in
namespace ‘urn:nhibernate-mapping-2.2’
has incomplete content. List of
possible elements expected: ‘meta,
subselect, cache, synchronize,
comment, tuplizer, id, composite-id’
in namespace
‘urn:nhibernate-mapping-2.2’.

The generated Orders.Core.Organization.hbm.xml was really empty:

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-access="">
  <class name="Orders.Core.Organization, Orders.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" table="Organizations" xmlns="urn:nhibernate-mapping-2.2" />
</hibernate-mapping>

So, after I reviewed the User.hbm I got the idea – I need to override Organization in the base class like this:

   public class UserMap : IAutoMappingOverride<User>
   {
      public void Override(AutoMap<User> mapping)
      {
         mapping.JoinedSubClass<Organization>("ColumnId", m => {...}
         );
      }
   }

But, I would better like to do this in a separate mapping override class for Organization… after all, what would the mapping become if I have 5 subclasses all in single Override method.

Is this possible?

  • 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-12T11:00:48+00:00Added an answer on May 12, 2026 at 11:00 am

    Turned out that with latest FNH (some revision after RC) this is possible now. I wonder if this is because I asked 😉

    So I had this

     mapping.JoinedSubClass<Organization>("UserId", m =>
        {
           m.HasMany(x => x.Currencies).Element("Currency").AsBag();
        }
     );
    

    and it stopped working after upgrading to RC. Then I moved this into its own class

       public class OrganizationMap : IAutoMappingOverride<Organization>
       {
          public void Override(AutoMapping<Organization> mapping)
          {
             mapping.HasMany(x => x.Currencies).Element("Currency").AsBag();
          }
       }
    

    it started to work again. Just like I wanted! Now I don’t even need to indicate JoinedSubClass as this is the default, anyway. I can just override my subclass properties which is cool.

    Though it wasn’t too easy to figure out why NH started to complain about association of strings… I even thought that .Element is broken in RC. I wonder why JoinedSubClass still has this mapping part if it doesn’t completely work.

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

Sidebar

Related Questions

I recently wrote a class for an assignment in which I had to store
Right, here's the story: We have had a website for one of our brands
Story: The user uploads an image that will be added to a photo gallery.
How to create a custom login system with google-app-engine's User class? I'm making my
I have a base class and 4 derived classes. I store all my derived
I have two models: User and Store class Store < ActiveRecord::Base belongs_to :user class
I've opened up an ExtJs project that I've not had my head in for
I'm writing a generic wrapper class for a bunch of classes we have defined
We had a meeting this morning about how would should store our ID for
If I had a million images, would it be better to store them in

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.