2017-06-21 292 views
-4
Controller: 
    @RequestMapping(value="/balance.html",method=RequestMethod.GET) 
     public ModelAndView balance_navigation(@ModelAttribute("command") NetBean netBean,BindingResult result){ 
      System.out.println("controller balance"); 
      //int bal= netservice.displaybalance(cid); 
      Map<String, Object> model = new HashMap<String, Object>(); 
      System.out.println("controller Map object balance"); 
      model.put("balance", netservice.displaybalance(cid)); 
      System.out.println("controller put() balance"); 
      return new ModelAndView("balance", model); 
Dao: 
`@Override 
    public int displaybalance(int cid) { 
    Session session=sessionFactory.openSession(); 
    System.out.println("query before executed in balance"); 
    Query query=session.createQuery("select accbal from Account as se where se.cid=cid"); 
    ////select ACCBAL from Account a join Customer s on a.cid=s.cid where s.cid=cid 
    System.out.println("query executed in balance"); 
    query.setParameter(0,cid); 
    return (int) query.list().get(0);` 

** org.springframework.web.bind.annotation.support.HandlerMethodInvocationException:未能調用處理程序方法[公共org.springframework.web.servlet.ModelAndView com.controller.Netcontroller.balance_navigation(com.bean .NetBean,org.springframework.validation.BindingResult)];嵌套的例外是java.lang.IllegalStateException:節點無數據類型:org.hibernate.hql.ast.tree.IdentNodeHTTP狀態500 - 請求處理失敗;嵌套異常

**

+0

你應該發佈一個更清晰的例子。您的代碼段似乎沒有使用任何Hibernate會話,也不涉及您在標題中提到的400錯誤。請參閱[MVCE](https://stackoverflow.com/help/mcve)尋求幫助。 – alexanderific

+0

請添加更多的代碼,所有你有依賴會話和URL映射 – Hema

回答

0

取代你的@ModelAttribute( 「命令」),以@ModelAttribute(」 netBean「) 同樣的事情jsp也ModelAttribute =」netBean「

+0

任何人都可以有springhibernate mvc anootation based sessionmangement類型eamle請幫助我 – yaswanthkumar

相關問題