• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Named query Exception

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi am trying to call stored procedure using hibernate framework.

my hbm.xml is
<hibernate-mapping>
<class name="com.SF.GCG.multiplayer.GameBO" table="game" catalog="game">
<id name="gameid" >
<column name="Game_id" />
<generator class="increment" />
</id>
............................
<sql-query name="game_rank" callable="true">
{ call lobby(?) }
</sql-query>

</class>
</hibernate-mapping>



............................................................................

my dao file is





public boolean insertrank(ChoiceViewBean choiceViewBean){
Session sessionObj;

try{
sessionObj = HibernateUtil.currentSession();
int gameid = choiceViewBean.getGameid();



//getHibernateTemplate().findByNamedQuery "game_rank", gameid);
sessionObj.getNamedQuery("game_rank").setParameter(1,gameid).list();
HibernateUtil.closeSession();

return true;
}catch(HibernateException e){
e.printStackTrace();
}
return false;

}


...........................................................................
and my procedure is


CREATE DEFINER=`root`@`localhost` PROCEDURE `lobby`(in gid int)
BEGIN
declare rk int;
declare t int;
declare n int;
declare k int;
declare scr int;
declare s int;
set n=1;
set rk=1;
select count(score) into t from game_user where game_id=gid and status=2;

while t>=1 do

..............................
end while;

select game_id, score,rank,status from game_user where game_id=gid;
END$$

DELIMITER ;



its for rank insering into table. this procedure is takes one argument .


i am geting he exception like

...........................................................................

org.hibernate.MappingException: Named query not known: game_rank
at org.hibernate.impl.AbstractSessionImpl.getNamedQuery(AbstractSessionImpl.java:70)
at org.hibernate.impl.SessionImpl.getNamedQuery(SessionImpl.java:1260)
at com.SF.GCG.multiplayer.MainGameDAO.insertrank(MainGameDAO.java:164)
at com.SF.GCG.multiplayer.ChoiceService.insertrank(ChoiceService.java:106)
at com.SF.GCG.multiplayer.ChoiceController.onSubmit(ChoiceController.java:73)
at org.springframework.web.servlet.mvc.SimpleFormController.processFormSubmission(SimpleFormController.java:258)
at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:249)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:740)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:684)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:394)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:358)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)

..... iam geting this exception


can any one solve this problem for me


Thanks in advance

K narendra
 
    Bookmark Topic Watch Topic
  • New Topic