问答详情
源自:3-3 显示学生资料-实现显示学生资料业务逻辑

Students is not mapped [from Students]

按老师的代码写的,

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],求助

提问者:许大虫 2017-02-27 21:15

个回答

  • qq_我是一只勤快鸟儿_03479056
    2017-07-04 13:10:05

    加上包名entity.Students

  • Sophomore
    2017-04-18 17:24:56

    你的实体类名时什么?Students替换成实体类名

  • 慕仙4555185
    2017-03-10 20:55:56

    你的实体类的名字一定和select * from 后的名字要一样