-->
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.  [ 6 posts ] 
Author Message
 Post subject: "Unknown entity class" problem with QuickStart tut
PostPosted: Thu Feb 01, 2007 1:51 pm 
Newbie

Joined: Thu Feb 01, 2007 1:42 pm
Posts: 1
Hello everyone,

I am just getting started with NHibernate, and I cant seem to get the quickstart demo running as described at:
http://www.hibernate.org/hib_docs/nhibe ... start.html.

The error I am getting is "Unknown entity class: QuickStart.Cat", which I believe means that NHibernate is not seeing my mapping file correctly. Other posts seem to point to the "embedded resource" problem in Visual Studio, but making that change did not seem to help anything. I also saw some mention that an error in the mapping file could cause this to happen, but since I copied/pasted right from the documentation, Im not sure how I could have got an error.

I took a screenshot of my project setup and mapping file in Visual Studio in case that might help determine what the problem is; that can be viewed by going here:
http://update.docutek.com/quickstart.gif

Im not sure what to try next, so I hope someone out there has some good ideas for me. So far getting started with NHibernate is taking much more effort than I had hoped, but Im not ready to give up yet!

Thanks in advance,

-Marc


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 02, 2007 4:04 am 
Senior
Senior

Joined: Mon Aug 21, 2006 9:18 am
Posts: 179
What version of NHib are you using?
Also, please post your whole stack trace including any inner exceptions.

The mapping file is using nhibernate-mapping-2.0 where the latest version of Nhib should use nhibernate-mapping-2.2 in the xmlns.

MIKE

_________________
If this helped...please remember to rate it!


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 04, 2007 3:23 pm 
Newbie

Joined: Fri May 04, 2007 2:12 pm
Posts: 3
I have the same problem.
I use NHibernate 1.2.0 and if I change <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" to 2.2 I get an such error (QuickStart.Cat.hbm.xml(2,2): XML validation error: Could not find schema information for the element 'urn:nhibernate-mapping-2.2:hibernate-mapping'.) when I make AddAssambly to configuration. May be I should include schema in VS2005?

the main problem with ("Unknow class entity") occur in SessionFactoryImpl.cs owned by NHibernate.dll
GetEntityPersister method get the Cat class but result will get a null.
What can I do? Please help.
public IEntityPersister GetEntityPersister(System.Type theClass)
{
IEntityPersister result = classPersisters[theClass] as IEntityPersister;
if (result == null)
{
throw new MappingException("Unknown entity class: " + theClass.FullName);
}
return result;
}


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 07, 2007 3:04 pm 
Newbie

Joined: Wed May 02, 2007 9:32 am
Posts: 17
I had the same problem as you, and as Mike mentioned the xml namespace in the new version is 2.2 and not 2.0 as indicated by the docs - changed this and it worked great.


Top
 Profile  
 
 Post subject: "Unknown entity class" problem with QuickStart tut
PostPosted: Tue Jan 13, 2009 7:53 am 
Newbie

Joined: Tue Jan 13, 2009 7:49 am
Posts: 1
I have changed the version to 2.2 still i am facing the same problem. Can any one help me on this?

Thanks,
RaviKumar


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 24, 2009 9:16 am 
Newbie

Joined: Tue Feb 24, 2009 9:09 am
Posts: 1
1-Make sure your mapping is correct
<class name="namespace.entityname, assembly name" table="tablename">

2- Make sure taht you have set the properties of hbm files as embedded Resource

This worked for me:D Resolved

_________________
AmnaIrshad


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