按老师的代码写的,
Session session = MyHibernateSessionFactory.getSessionFactory().getCurrentSession();
tx = session.beginTransaction();
hql = "from Students";
// hql = "select * from Students";
Query query = session.createQuery(hql);
// Query query = session.createSQLQuery(hql);
list = query.list();
tx.commit();
return list;
会报错:Students is not mapped [from Students],求助
加上包名entity.Students
你的实体类名时什么?Students替换成实体类名
你的实体类的名字一定和select * from 后的名字要一样