-->
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.  [ 5 posts ] 
Author Message
 Post subject: Newbie Desperately need help
PostPosted: Mon May 22, 2006 12:37 am 
Beginner
Beginner

Joined: Mon May 22, 2006 12:12 am
Posts: 23
Hi,

I'm completely new to NHibernate. I've been trying hard following the QuickStart and other resources but hitting a number of obstacles.

Well, I'm developing using Visual Studio Web Developer Express. Understand that this is not a complete product. But I think I can still use it, just with more steps?

My present error is:
"Could not load type 'RHU.LicenseeCandidate, NHibernate, Version=1.0.2.0, Culture=neutral, PublicKeyToken=154fdcb44c4484fc', check that type and assembly names are correct"

I've the C# class LicenseeCandidate.cs file under the App_Code folder.
I've the mapping LicenseeCandidate.hbm.xml file under the same folder as well.

Part of the xml file:
"<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="RHU.LicenseeCandidate" table="LicenseeCandidate">"


My hiberante.cfg.xml file:

<?xml version="1.0" encoding="utf-8" ?>
<nhibernate xmlns="urn:nhibernate-configuration-2.0" >
<session-factory name="RHU">
<!-- properties -->
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="connection.connection_string">Server=localhost;initial catalog=RAMS;User Id=;Password=</property>
<property name="show_sql">false</property>
<property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
<property name="use_outer_join">true</property>
<!--
these are different than the values in app.config so I can verify these
are being picked up
-->
<property name="command_timeout">444</property>
<property name="query.substitutions">true 1, false 0, yes 1, no 0</property>
<!-- mapping files -->
<!-- are now optional -->
<mapping file="C:\WebSites\RHUSpace\App_Code\LicenseeCandidate.hbm.xml" />
<mapping resource="RHU.LicenseeCandidate.hbm.xml" assembly="RHU" />
<!-- -->
</session-factory>

</nhibernate>


I don't quite understand the meaning of ASSEMBLY here. Should I simply treat as namespace that I"ve provided for the classes?



The error comes out on running the code:

Configuration cfg = new Configuration();
cfg.AddFile(System.Web.HttpContext.Current.Server.MapPath("~/App_Code/LicenseeCandidate.hbm.xml"));
cfg.Configure();

The 2nd line hits the error. i.e. when loading the xml mapping file.


I don't know. I've hit a number of issues. Earlier I was prompted that log4net couldn't be found. Finally, I copy log4net.dll to my project and gave it Reference and then it is ok. But documentation doesn't mention this... Or I missed something?


Your advice much much appreciated. Thanks!
jL

NHibernate version 1.02

MS SQL Server 2005 Express


Top
 Profile  
 
 Post subject: Miss something in the Assembly name?
PostPosted: Mon May 22, 2006 3:09 am 
Beginner
Beginner

Joined: Mon May 22, 2006 12:12 am
Posts: 23
Hi,


Or My problem is because I haven't named assembly correctly? But in Visual Web Developer, I don't see a place to name assembly at the Project properties page....

Anyone have experience?

thanks,
jL


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 22, 2006 4:01 am 
Newbie

Joined: Tue Mar 07, 2006 4:56 am
Posts: 17
Hi JL,

I can't give you a direct solution to your problem, as I'm still quite new to nHibernate and .Net as well (and haven't done anything at all using ASP.Net)...

However, an assembly is nothing else as a file containing your application's code. This could be a DLL or an EXE. To rename the assembly, you simply rename your project, hence the file-name of the compliled code.

The error message seems to say, that it cannot find this specified assembly. Maybe it's named differently?

The namespace has nothing to do with the assembly name (though it's often useful to name them similiar, so they can be easily associated).

Kind regards, Marco...


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 22, 2006 5:07 am 
Regular
Regular

Joined: Thu May 11, 2006 12:30 pm
Posts: 72
RHU is your .NET namespace ?

if yes, try to put it into the class name

<class name="RHU.LicenseeCandidate, RHU" table="LicenseeCandidate">"

then be sure that your hbm.xml files are built as embedded resources; to check this click your hbm.xml file in Visual Studio Solution Explorer and check that Build Action property is set to Embedded Resource

HTH
Luca


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 22, 2006 6:21 am 
Expert
Expert

Joined: Thu Jan 19, 2006 4:29 pm
Posts: 348
berets wrote:
<class name="RHU.LicenseeCandidate, RHU" table="LicenseeCandidate">"


If this does not help, start Your app in debugger and find out the full name of the object. With somthing like typeof(LicenseeCandidate).FullName

From that, You should be able to deduce what the name of class should be (AFAIK You can omit some parts from that string...)

or, the code You might use:

Code:
LicenseeCandidate l = new LicenseeCandidate();
Console.WriteLine(l.GetType().FullName);


Gert

_________________
If a reply helps You, rate it!


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