public void updateBookSnum(Integer isbn,Integer num){
try {
Session session = this.getHibernateTemplate().getSessionFactory().openSession();
Query query = session.createQuery("update book b set b.snum="+num+" where b.isbn="+isbn+" ");
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=9 where b.isbn=555
我的数据库 的列 snum isbn 都是Interger 就是Int类型的 传进来的数据也是int类型的 book模型里面 显示的也是
private Integer isbn;private Integer snum; 为什么就会出错呢 ??? 到底是什么错呢?? 谢谢大家~

------解决思路----------------------
把你book的实体类和hbm都发一下
------解决思路----------------------
在HQL语句中所有Hibernate里映射的都是实体类开头都得大写,如果在sql语句中是可以不考虑大小写的
------解决思路----------------------
在HQL语句中,是对对象进行操作 你把里面的book换成Book,列换成Book类中的属性试一下