因为是反向工程过来的 所以 hbm.xml 里面 我看了下 确实是有 snum 和 isbn列的

解决方案 »

  1.   

    public void updateBookSnum(Integer isbn,Integer num){
    try {
    Session session = this.getHibernateTemplate().getSessionFactory().openSession();
    String query =  "update book b set b.snum=? where b.isbn=? " ;
    Query q = session.createQuery(query);
    q.setInteger(0,num);
    q.setInteger(1,isbn);
    q.executeUpdate();
    //query.executeUpdate();
    session.close();
    System.out.println("bookdao updateBookSnum调用成功!");
    } catch (RuntimeException re) {
    log.error("find all failed", re);
    throw re;
    }改成这样写后 还是报错   book is not mapped [update book b set b.snum=? where b.isbn=? ]
      

  2.   

    结贴了 不是book  是Book
      

  3.   

    把你book的实体类和hbm都发一下
      

  4.   

    在HQL语句中所有Hibernate里映射的都是实体类开头都得大写,如果在sql语句中是可以不考虑大小写的
      

  5.   

    在HQL语句中,是对对象进行操作 你把里面的book换成Book,列换成Book类中的属性试一下