-->
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: Retrieving list of employees works - single employee doesn't
PostPosted: Tue Jan 10, 2006 6:05 am 
Newbie

Joined: Mon Jan 09, 2006 9:38 am
Posts: 1
Hi folks,

I'm stuck again.....

I picked the "Employees" table from the SQL Server 2000 installation for my testing. I created a NHibernate mapping file and a C# class file, and I can now grab all the employees from the table and show them in my ASP.NET app - no problem.

However, I cannot seems to load single user from the table - neither <session>.Load nor <session>.Get seem to work, both complaining that they cannot find the "Mycompany.Data.Employee" data type.....

Any ideas???

Here's my code:

using MyCompany.Data;

Employee oEmp = (Employee)oSess.Get(typeof(Employee), 1);


I can load the whole list of employees, and I can also do a

IList empList = oSess.CreateQuery("from Employee as e where e.Id = :ID").SetInt32("ID", 1).List();

and get a single "Employee" instance that way - but the .Get and .Load methods both consistently fail.

HOWEVER: when I move the Employee.hbm.xml and Employee.cs files into my main project assembly, everything works just like a charm! That's not the way I thought I would have it though.... I would prefer to have all my mappings and data objects in a separate assembly - why can't I do that??

Thanks!
Marc


Top
 Profile  
 
 Post subject: Re: Retrieving list of employees works - single employee doe
PostPosted: Tue Jan 10, 2006 11:58 am 
Contributor
Contributor

Joined: Thu May 12, 2005 8:45 am
Posts: 226
mscheuner wrote:
HOWEVER: when I move the Employee.hbm.xml and Employee.cs files into my main project assembly, everything works just like a charm! That's not the way I thought I would have it though.... I would prefer to have all my mappings and data objects in a separate assembly - why can't I do that??


What assembly were you using in your Configuration code? It could be that the assembly they were originally in was not being added to NHibernate's Configuration.


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.