-->
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: Nmaed Query Problem
PostPosted: Wed Feb 14, 2007 1:51 am 
Newbie

Joined: Sat Dec 02, 2006 4:23 am
Posts: 17
HI,

I have written a query in my hibernate mapping document.Here is the snippet:

<query name="insert">

from Hibernate_test_insert where employeeid = ?
</query>

But when i call from my code as :

Query q = HibernateUtil.getSessionFactory().getCurrentSession().getNamedQuery("insert");
q.setString("employeeid",id);
Hibernate_test_insert obj = (Hibernate_test_insert) q.uniqueResult();

It throws an exception that :

org.hibernate.MappingException: Named query not known: insert


Any Ideas guys?

Regards,
Jasmine.


Top
 Profile  
 
 Post subject: Re: Named Query Problem
PostPosted: Wed Feb 14, 2007 2:18 am 
Newbie

Joined: Sat Dec 02, 2006 4:23 am
Posts: 17
jasmine wrote:
HI,

I have written a query in my hibernate mapping document.Here is the snippet:

<query name="insert">

from Hibernate_test_insert where employeeid = ?
</query>

But when i call from my code as :

Query q = HibernateUtil.getSessionFactory().getCurrentSession().getNamedQuery("insert");
q.setString("employeeid",id);
Hibernate_test_insert obj = (Hibernate_test_insert) q.uniqueResult();

It throws an exception that :

org.hibernate.MappingException: Named query not known: insert


Any Ideas guys?

Regards,
Jasmine.


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.