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.  [ 3 posts ] 
Author Message
 Post subject: Help with Tutorial (NHibernate.MappingException)
PostPosted: Sat Aug 19, 2006 4:01 pm 
Newbie

Joined: Sat Aug 19, 2006 3:40 pm
Posts: 2
I'm trying to work off of the NHibernate 1.0.2 tutorial with VS.NET 2005. Surely through my own fault, I'm unable to save my first NHibernate object. The error I get when running a web page with code behind page load event to save my Cat is:

NHibernate.MappingException: Unknown entity class: QuickStart.Cat

What I did to get this was to put in my web.config:

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.0">
<session-factory>
<property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
<property name="hibernate.connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.connection_string">Server=(local);Database=Northwind;Trusted_Connection=True;</property>
<mapping assembly="QuickStart"/>
</session-factory>
</hibernate-configuration>

And my project has a reference to an assembly QuickStart, which has verbatim the Cat.cs class and Cat.hbm.xml file from the tutorial. Which to say, the mapping file starts with:

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"
namespace="QuickStart" assembly="QuickStart">
<class name="Cat" table="Cat">

and the Cat.cs file properly notes the namespace it belongs to as QuickStart.

Any help with where I went wrong would be appreciated. (The version of NHibernate I am using is 1.2.0.Alpha1-Debug)

_________________
Chad Price


Top
 Profile  
 
 Post subject: Type 'QuickStart.Cat' cannot be specified as proxy
PostPosted: Sat Aug 19, 2006 4:17 pm 
Newbie

Joined: Sat Aug 19, 2006 3:40 pm
Posts: 2
After making the cat.hbm.xml Embedded Resource in the Assembly, suggested by another tutorial, I was able to get past this error, and instead receive now:

Type 'QuickStart.Cat' cannot be specified as proxy: method get_Id should be virtual

_________________
Chad Price


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 20, 2006 10:49 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
The tutorial is for 1.0.2, if you are using 1.2.0 alpha, add lazy="false" to <class> mapping.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.