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: simple query exception
PostPosted: Wed Sep 20, 2006 8:55 pm 
Newbie

Joined: Wed Sep 20, 2006 8:43 pm
Posts: 2
Location: San Francisco
Hi all, I am just beginning on NHibernate. I am excited about the potential, but I'm stumbling quite a bit on these first few 'hello world' tests and trials.

I keep getting the "in expected: (possibly an invalid or unmapped class name was used in the query)" exception. All the example HQL queries I've seen show that I should be able to just do a simple "from ClassName".

It seems my issue must be trivial, but I just can't pin-point it.

Hibernate version: 1.0.2

Mapping documents:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"
namespace="NHibernate_QuickStart" assembly="NHibernate_QuickStart">

<class name="UploadedEventFiles" table="uploadedEventFiles">
<id name="UploadID" column="uploadID" sql-type="int" not-null="true">
<generator class="identity" />
</id>

<property name="OriginalFileName" column="originalFileName" sql-type="nvarchar(200)" not-null="true" />
<property name="UserID" column="userID" sql-type="int" not-null="true" />
<property name="RowCount" column="fileRowCount" sql-type="bigint" not-null="true" />
<property name="Status" column="status" sql-type="int" not-null="true" />
<property name="Errors" column="errors" sql-type="nvarchar(2000)" not-null="false" />
<property name="DateTimeAdded" column="dateTimeAdded" sql-type="smalldatetime" not-null="true" />
</class>

</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():

IQuery query = sess.CreateQuery(" from UploadedEventFiles");

foreach (UploadedEventFiles f in query.Enumerable())
{
Response.Write("row " + f.UploadID + ": " + f.OriginalFileName + ", " + f.RowCount + "<br/>");
}

Full stack trace of any exception that occurs:

at NHibernate.Hql.FromParser.End(QueryTranslator q) at NHibernate.Hql.ClauseParser.End(QueryTranslator q) at NHibernate.Hql.PreprocessingParser.End(QueryTranslator q) at NHibernate.Hql.ParserHelper.Parse(IParser p, String text, String seperators, QueryTranslator q) at NHibernate.Hql.QueryTranslator.Compile() at NHibernate.Hql.QueryTranslator.Compile(ISessionFactoryImplementor factory, IDictionary replacements, Boolean scalar) at NHibernate.Impl.SessionFactoryImpl.GetQuery(String queryString, Boolean shallow) at NHibernate.Impl.SessionImpl.GetQueries(String query, Boolean scalar) at NHibernate.Impl.SessionImpl.Enumerable(String query, QueryParameters parameters) at NHibernate.Impl.QueryImpl.Enumerable() at NHibernate_QuickStart._Default.Page_Load(Object sender, EventArgs e) in C:\Documents and Settings\Mason Blake\My Documents\Visual Studio 2005\Projects\NHibernate_QuickStart\NHibernate_QuickStart\Default.aspx.cs:line 29


Name and version of the database you are using: SQL Server 2000


Top
 Profile  
 
 Post subject: help!
PostPosted: Thu Sep 21, 2006 1:46 pm 
Newbie

Joined: Wed Sep 20, 2006 8:43 pm
Posts: 2
Location: San Francisco
This is such a trivial issue, and nobody has any advice? I need some help - please!


Top
 Profile  
 
 Post subject: Re: help!
PostPosted: Thu Sep 21, 2006 4:24 pm 
Expert
Expert

Joined: Thu Jan 19, 2006 4:29 pm
Posts: 348
mase wrote:
This is such a trivial issue, and nobody has any advice? I need some help - please!


The best advice I can give - make sure that the mapping files are loaded by NHibernate. This check should be obvious from the error, so that's proably the reason noone answers.

Gert

_________________
If a reply helps You, rate it!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 11, 2009 7:25 pm 
Beginner
Beginner

Joined: Fri Jul 06, 2007 9:27 pm
Posts: 22
The error message means that NHibernate can't find the mapping file. The first thing to do is verify that the Build Action property on the mapping file is set to Embedded Resource.


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.