-->
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: Unknown entity class
PostPosted: Mon Mar 06, 2006 2:22 pm 
Newbie

Joined: Wed Jul 13, 2005 3:43 am
Posts: 8
Location: Redmond, WA
I am having problems in my ASP.NET 2.0 website with adding my mapping files correctly (or at least I think).

I have tried mapping with attributes, manually adding the hbm.xml by path, and putting the classes and hbm.xml files in a seperate class project and then adding the assembly.

I keep getting: Unknown entity class: Library.Player exception when I try to save a new object.

Right now I have the classes and mapping files in an assembly and then trying to add it.

Here is where I add the assembly:
Code:
NHibernate.Cfg.Configuration config = new NHibernate.Cfg.Configuration();
config.AddAssembly(typeof(Library.Player).Assembly);
NHibernate.ISessionFactory factory = config.BuildSessionFactory();


This is my Player.hbm.xml file located in the same assembly:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
  <class name="Library.Player, Library" table="player">
    <id name="Username" column="username">
      <generator class="assigned"/>
    </id>
   
    <version name="Version" column="version"/>
  </class>
</hibernate-mapping>


What do I need to go to get it to load the configuration correctly?

_________________
- Steven


Top
 Profile  
 
 Post subject: Solved
PostPosted: Mon Mar 06, 2006 8:13 pm 
Newbie

Joined: Wed Jul 13, 2005 3:43 am
Posts: 8
Location: Redmond, WA
I had two problems, first it was looking for the .hbm.xml file with the full qualified class name rather than just the class name.

Second, it was not including the xml file in the assembly. I had to go into the file's properties and set it as embedded. That seemed to do the trick!

_________________
- Steven


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.