-->
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.  [ 7 posts ] 
Author Message
 Post subject: NHibernate in Visual Web Developer Express 2005
PostPosted: Mon Jan 08, 2007 10:16 am 
Newbie

Joined: Mon Jan 08, 2007 10:04 am
Posts: 5
Hi everyone,

I've got a problem using NHibernate under Visual Web Developer Express.

I've created a new web project, added the NHibernate references and created a persistant class named Employe in the file Employe.cs.

I've created the mapping file "Employe.hbm.xml" and placed it in the same directory than "Employe.cs".

But when i launch the project, i've got this error :

Code:
Resource not found: NHib_log.Employe.hbm.xml


(NHib_log is the project's name)


The error is linked with this code :

Code:
config = new Configuration().AddClass(typeof(Employe));


I've tried to add directly the assembly but the error is similar.


I've made researches on the web and I think the problem comes from the fact that the mapping file "Employe.hbm.xml" has to be declared as an Embedded Resource in the build action propertie. But there is no build action propertie in visual web developer.
I tried other ways but nothing is working so far.

So, I don't know what to do, knowing that I'm pretty sure all the rest of the code is ok...

If somebody knows how to deal with that, thank you for the help !


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 08, 2007 6:46 pm 
Newbie

Joined: Thu Sep 01, 2005 3:55 pm
Posts: 11
I haven't used Express but I have used NHibernate in VS2005 without a project.

I place my class in the App_Code directory and my xml files in App_Code\Resources. Then I build the config like this:

Code:
Configuration cfg = new Configuration();
string basePath = System.Web.HttpContext.Current.Server.MapPath(@"~/App_Code/Resources/");
cfg.AddXmlFile(basePath+"Portfolio.hbm.xml");


My xml file starts like this. Note that the classes will live in the App_Code.dll assembly.

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="Domain.Portfolio, App_Code" table="PortfolioHead">
...

_________________
~Dave Foderick


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 09, 2007 5:37 am 
Newbie

Joined: Mon Jan 08, 2007 10:04 am
Posts: 5
Hi,
thanks for your reply dfoderick.

I used your method and the "hbm.xml" file is recognized now !

But, it has brought another error :

Code:
Unable to recognize 'urn:nhibernate-mapping-2.0:hibernate-mapping'.


That is the code which is at the beginning of the "hbm.xml" file :

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"
                   namespace="NH_Initiation" assembly="NH_Initiation">
  <class name="Nh_Initation.Employe, App_Code" table="e_emp">
...


I don't know if it comes from the same problem of embedded resource. I've searched but nothing is working.

If you or anyone else has a clue, thank you !


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 09, 2007 5:43 am 
Newbie

Joined: Thu Jan 04, 2007 3:56 pm
Posts: 11
If you're using nhibernate beta 2 (version 1.2.0.2002) your mapping should look something like this (notice that the 2.2 differ):

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<!--...-->
</hibernate-mapping>


Regards,

Cristian

Radikal wrote:
Hi,
thanks for your reply dfoderick.

I used your method and the "hbm.xml" file is recognized now !

But, it has brought another error :

Code:
Unable to recognize 'urn:nhibernate-mapping-2.0:hibernate-mapping'.


That is the code which is at the beginning of the "hbm.xml" file :

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"
                   namespace="NH_Initiation" assembly="NH_Initiation">
  <class name="Nh_Initation.Employe, App_Code" table="e_emp">
...


I don't know if it comes from the same problem of embedded resource. I've searched but nothing is working.

If you or anyone else has a clue, thank you !


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 09, 2007 12:00 pm 
Newbie

Joined: Mon Jan 08, 2007 10:04 am
Posts: 5
Thank you for your help libardo and dfoderick, it works now !


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 10, 2007 5:18 pm 
Newbie

Joined: Thu Sep 01, 2005 3:55 pm
Posts: 11
Yeah, my xml file was for NHibernate 1.0. I'm going to upgrade soon to 1.2.

Glad you got it working.

_________________
~Dave Foderick


Top
 Profile  
 
 Post subject: Re: NHibernate in Visual Web Developer Express 2005
PostPosted: Fri Jul 22, 2011 4:42 am 
Newbie

Joined: Fri Jul 22, 2011 4:41 am
Posts: 1
Web developers create web form templates. This programming code is used to manage a consistent look and a smooth interface on a website. Its interface is easy to use design with a similar structure in all its pages. If your organization is trying to change business models, it is very difficult to change all pages. If you do not have a specific structure or specific models of web form, it will be harder for you to handle this.

Los Angeles Website Design


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