2017-06-21 17 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ベースのsessionmangement type eamleを持っています – yaswanthkumar

関連する問題