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.  [ 4 posts ] 
Author Message
 Post subject: Can't compile the mapping document
PostPosted: Thu Jan 24, 2008 6:46 pm 
Newbie

Joined: Thu Jan 17, 2008 11:45 am
Posts: 9
Location: VA
I'm trying to set up an application where all the persistence classes and xml mapping documents live in a common project, separate from the domain layer. When I try and Add the assembly I receive the following exception:

Configuration config = new Configuration();
config.AddAssembly("Common.Tools"); <-- Exception thrown on this line in my code.

First exception is this: e = {"Could not compile the mapping document: Common.Tools.Entities.Device.hbm.xml"}

The inner exception is this: InnerException = {"persistent class Common.Tools.Entities.Site, Common.Tools.Entities not found"}

The next inner exception is this: InnerException = {"Could not load file or assembly 'Common.Tools.Entities' or one of its dependencies. The system cannot find the file specified.":"Common.Tools.Entities"}


The files actually live under Common.Tools in a folder called Entities but when I and add the "Common.Tools.Entities" assembly I receive the following exception:

[NHibernate.MappingException] = {"Could not add assembly Common.Tools.Entities"}

InnerException = {"Could not load file or assembly Common.Tools.Entities' or one of its dependencies. The system cannot find the file specified.":"Common.Tools.Entities"}


I think I have all my project references correct but I'm not ruling anything out at this point. It appears that I make it further when I try and add "Common.Tools" but since my mapping files reference Common.Tools.Entities it makes it to the file and then fails. Here's a copy of my XML file:

<hibernate-mapping default-cascade="none" xmlns="urn:nhibernate-mapping-2.2">
<class name="Common.Tools.Entities.Device, Common.Tools.Entities" table="Device">
<id name="DeviceId" type="System.Guid" column="DeviceId" unsaved-value="00000000-0000-0000-0000-000000000000">
<generator class="guid" />
</id>
<property name="Name" type="System.String" column="Name" not-null="true" length="50" />
<property name="ActiveInd" type="System.Boolean" column="ActiveInd" not-null="true" />
<many-to-one name="DeviceTypeLookup" class="Common.Tools.Entities.DeviceTypeLookup, Common.Tools.Entities" fetch="select">
<column name="DeviceTypeCode" not-null="true" />
</many-to-one>

</class>
</hibernate-mapping>


I've search and tried just about everything I've read here on the forums but I'm new to NHibernate (I'm actually trying to do a prototype for an upcoming winform project) so please bear with me.


Top
 Profile  
 
 Post subject: Can't compile the mapping document
PostPosted: Thu Jan 24, 2008 7:13 pm 
Senior
Senior

Joined: Thu Jun 21, 2007 8:03 am
Posts: 127
Location: UK
Hi Marc,

Just a thought, but if the assembly is "Common.Tools.dll", then perhaps the line

Code:
<class name="Common.Tools.Entities.Device, Common.Tools.Entities" table="Device">

should be changed to

Code:
<class name="Common.Tools.Entities.Device, Common.Tools" table="Device">


Richard


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 25, 2008 9:39 am 
Newbie

Joined: Thu Jan 17, 2008 11:45 am
Posts: 9
Location: VA
Richard, thank you very much!

I made the change and it works. I appreciate your help.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 02, 2008 8:44 am 
Newbie

Joined: Wed Apr 02, 2008 8:38 am
Posts: 1
I am facing a problem which says :


System.Collections.Generic.KeyNotFoundException:The given key was not present in the dictionary

Could anyone know how to resolve this kind of issue.

Thanks in advance


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.