hibernate createQuery

在一次简单修改数据库之后,数据库的所有存取代码都失效了 例如:[code="java"]
Session sess = HibernateSessionFactory.getSession();
Transaction tran = sess.beginTransaction();
Notice notice = (Notice)sess.get(Notice.class, id);
tran.commit();
sess.close();
[/code]
报错
[code="java"]
could not load an entity: [pojo.Notice]
SELECT command denied to user 'bjettccom'@'127.0.0.1' for table 'notice'
[/code]
若是将代码改成[code="java"]
Query q = sess.createSQLQuery("select * from notice as notice where notice.id = '"+id+"'").addEntity(Notice.class);;
Notice notice = (Notice)q.list().get(0);
[/code]
就可以,但是这样一来我所有相关的代码都要改,很麻烦,有遇到过相似问题的请知道一下,非常感谢!

你确定该类得mapping文件被hibernate正常加载了吗?