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: Need help with Named Queries...!
PostPosted: Fri Dec 19, 2008 6:36 am 
Newbie

Joined: Thu Dec 18, 2008 6:14 am
Posts: 3
Hi, I need a little help in using named queries..

I have defined a query in mapping file, outside the main class.

<sql-query name="DeleteQuery">
<![CData[Delete From testcust t Where t.Emp_ID = ?]]>
<return alias="t" class="testcust"/>
</sql-query>

and refer it in main class named : NHibernateEx.testcust

<class="NHibernateEx.testcust" namespace=blaa blaa/>
....
<loader query-ref = "DeleteQuery"/>
...
</class>


then i used that named query in my coding.

mySession.GetNamedQuery("DeleteQuery")

When compile, it gives an error: unknown class testcust

How to solve this error? Or what is the correct way to do this task?
Waiting for ur replies..
Regards.
Ovais


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 19, 2008 7:50 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Have you defined the correct namespace and assembly name in the surrounding hibernate-mapping tag:

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="x.y.z" assembly="MyAssembly">

You have to at least specifiy the assembly and then you can use the fqn in the query, e.g. x.y.z.testcase.

_________________
--Wolfgang


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.