These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: MappingException: Association references unmapped class
PostPosted: Tue Nov 03, 2009 12:49 am 
Newbie

Joined: Tue Oct 06, 2009 5:32 am
Posts: 2
Hi all,
I have a problem when I create session factory from configuration objects, I always catch an issue:
Association references unmapped class: Order

my create session factory code:

Configuration cfg = new Configuration()
.AddAssembly("NHibernateSimpleDemo");
m_SessionFactory = cfg.BuildSessionFactory();

my Order.hbm.xml file:

<?xml version="1.0"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" schema="dbo">

<!-- Mappings for class 'Order' -->
<class name="NHibernateSimpleDemo.Order, NHibernateSimpleDemo" lazy="false" >

<!-- Identity mapping -->
<id name="ID" column="OrderID" type="Int32">
<generator class="native" />
</id>

<!-- Simple mappings -->
<property name="Date" column="Date" />

<!-- Many-to-one mapping: Customer -->
<many-to-one name="Customer" column="CustomerID" class="NHibernateSimpleDemo.Customer, NHibernateSimpleDemo"
cascade="none" />

<!-- Many-to-many mapping: OrderItems -->
<bag name="OrderItems" table="OrderItems" cascade="none" lazy="false">
<key column="OrderID" />
<many-to-many class="NHibernateSimpleDemo.Product, NHibernateSimpleDemo" column="ProductID" />
</bag>

</class>

</hibernate-mapping>

I already set hbm.xml files to "embedded resource"

Any help will be appeciated

Thanks all


Top
 Profile  
 
 Post subject: Re: MappingException: Association references unmapped class
PostPosted: Fri Dec 04, 2009 4:58 pm 
Newbie

Joined: Fri Dec 04, 2009 4:55 pm
Posts: 1
Make sure you 'rebuild' the entire solution, so that the embedded resource actually gets included in your DLL. Also, make sure your column names in your Order.hbm.xml file match your 'Order' table. The demo had the column names 'OrderDate' and 'Customer', not 'Date' and 'Customer' as you have specified.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.