-->
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: error while running Nhibernate application
PostPosted: Thu May 01, 2008 8:16 am 
Newbie

Joined: Thu May 01, 2008 8:01 am
Posts: 3
My aplication is for loaing the gridview with data from database by using nhibernate and saving the data into database
while running nhibernate application iam getting the following errors:

while loading with gridview:
my code is as follows:
ISession session = NHibernateHttpModule.CurrentSession;


IQuery query = session.CreateQuery("FROM DbUser");
IList result = query.List();

GridView1.DataSource = result;
GridView1.DataBind();
my error is as follows:
in expected: <end-of-text> (possibly an invalid or unmapped class name was used in the query) [FROM DbUser]


while saving the data to database:
my code is as follows:

ISession session = NHibernateHttpModule.CurrentSession;
ITransaction transaction = session.BeginTransaction();

DbUser user = new DbUser();
user.Login = "codegod";
user.Password = "secret";
user.UserData = "vfgfhggfhgh";
session.Save(user);
transaction.Commit();
my error is as follows:
Unknown entity class: NHibernateASPSample.Domain.DbUser
session.save(user);


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 01, 2008 4:27 pm 
Regular
Regular

Joined: Mon Mar 20, 2006 10:49 pm
Posts: 59
The DbUser class is not mapped. It's impossible to say why without seeing the code used to initialize the NHibernate configuration. If you are using AddAssembly to load mappings, verify that the hbm.xml files have BuildAction set to EmbeddedResource.

_________________
Mike Abraham


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.