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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:40:12+00:00 2026-05-19T04:40:12+00:00

I have this: namespace Demo.Framework.Domain { public class UserEntity { public virtual Guid UserId

  • 0

I have this:

namespace Demo.Framework.Domain
{
    public class UserEntity
    {
        public virtual Guid UserId { get; protected set; }
    }
}

namespace TDemo.Framework.Domain
{
    public class Users : UserEntity
    {
        public virtual string OpenIdIdentifier { get; set; }
        public virtual string Email { get; set; }
        public virtual IList<Movie> Movies { get; set; }
    }
}

namespace Demo.Framework.Domain
{
    public class Movie
    {
        public virtual int MovieId { get; set; }
        public virtual Guid UserId { get; set; } // not sure if I should inherit UserEntity
        public virtual string Title { get; set; }
        public virtual DateTime ReleaseDate { get; set; } // in my ms sql 2008 database I want this to be just a Date type. Not sure how to do that.
        public virtual int Upc { get; set; }

    }
}

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
    assembly="Demo.Framework"
    namespace="Demo.Framework.Domain">
    <class name="Users">
        <id name="UserId">
            <generator class="guid.comb" />
        </id>
        <property name="OpenIdIdentifier" not-null="true"  />
        <property name="Email" not-null="true" />      
    </class>
    <subclass name="Movie">
        <list name="Movies" cascade="all-delete-orphan">
            <key column="MovieId" />
            <index column="MovieIndex" /> // not sure what index column is really.
            <one-to-many class="Movie"/>
        </list>
    </subclass>     
</hibernate-mapping>

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
    assembly="Demo.Framework"
    namespace="Demo.Framework.Domain">
    <class name="Movie">      
        <id name="MovieId">
            <generator class="native" />
        </id>
        <property name="Title" not-null="true" />
        <property name="ReleaseDate" not-null="true" type="Date" />
        <property name="Upc" not-null="true" />
        <property name="UserId" not-null="true" type="Guid"/>
    </class>
</hibernate-mapping>

I get this error:

'extends' attribute is not found or is empty.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: NHibernate.MappingException: 'extends' attribute is not found or is empty.

Source Error:

Line 19:             var nhConfig = new Configuration().Configure();
Line 20:             var sessionFactory = nhConfig.BuildSessionFactory();
  • 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-19T04:40:13+00:00Added an answer on May 19, 2026 at 4:40 am

    NHibernate has it’s roots in java, where a subclass “extends” a base class, and this is sometimes a useful mapping element when defining hierachies across different hbm files.

    The reason you are seeing that error is the way you are mapping the user’s movies as a “subclass”. This is confusing NHib, since you aren’t extending anything. Remove the “subclass” node surrounding your list and that error will go away.

    As an aside, Jamie is right as to why the list index is required. The list mapping is fine, but unless there is a compelling reason to not do so, I typically want set semantics for my one to many relationships, which looks like the example below in an hbm.

    HTH,
    Berryl

    <set access="field.camelcase-underscore" cascade="none" inverse="true" name="Employees">
      <key foreign-key="Employee_Department_FK">
        <column name="DepartmentId" />
      </key>
      <one-to-many class="Employee" />
    </set>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class in my domain model root that looks like this: namespace
I have this code: namespace TuyenTk { public partial class Form1 : Form {
So i have this class namespace WindowsFormsApplication2 { public class Records { public string
I have this namespace in Extensions.cs file: namespace TextBoxExtensions { public static class TextBoxExtensionsClass
I have an Interface like this: namespace QuickRoutes.Model.Utilities { public interface IRoutesManager { bool
I have a static class that looks like this: namespace Argus { static class
I have this code (C#): using System.Collections.Generic; namespace ConsoleApplication1 { public struct Thing {
I have this in furniture.h: #include <iostream> #include <string> using namespace std; class Furniture
friends i have problem with using get or set in class in c# when
Consider this simple console application: using System; namespace Demo { class Program { static

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.