org.hibernate.hql.ast.QuerySyntaxException: xxx is not mapped [from xxx]
2013-12-20 15:53
489 查看
xxx is not mapped[from xxx]
在使用hibernate的时候,经常出现一些小错误,如下面这个错误提示:org.hibernate.hql.ast.QuerySyntaxException: student
is not mapped [ from student],
意思是没有映射到student 这个类中,那怎么办呢。
在hibernate中查询语句是区分大小写的,你看这是我写的语句:
Session session = HibernateSessionFactory.getSession();//获得Session对象
Query query = session.createQuery("from student");
List<Data> list = query.list();
session.createQuery("from student");中的 "from student "没有映射到实体类中,
跟直接使用sql操作时不太一样的,因为我的student 类是 Student.java
所以相应的把 from student 改成 from Student (注意大写),这样hibernate就可以找到这个实体类了。
相关文章推荐
- org.hibernate.hql.ast.QuerySyntaxException: xxx is not mapped [from xxx]
- org.hibernate.hql.ast.QuerySyntaxException: XXX is not mapped [from XXX]
- org.hibernate.hql.internal.ast.QuerySyntaxException: XXX is not mapped [from XXX]
- org.hibernate.hql.ast.QuerySyntaxException: xxx is not mapped
- Hibernate查询报错:org.hibernate.hql.internal.ast.QuerySyntaxException: XXX is not mapped
- SSH出错--hibernate--org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User]
- org.hibernate.hql.ast.QuerySyntaxException per is not mapped [from Per as p]
- org.hibernate.hql.ast.QuerySyntaxException:is not mapped 异常总结
- org.hibernate.hql.ast.QuerySyntaxException: myaddressbook is not mapped
- org.hibernate.hql.ast.QuerySyntaxException: is not mapped
- org.hibernate.hql.ast.QuerySyntaxException: XX is not mapped hibernate 注解出错
- org.hibernate.hql.ast.QuerySyntaxException:is not mapped 异常总结
- org.hibernate.hql.ast.QuerySyntaxException: buyer is not mapped
- org.hibernate.hql.ast.QuerySyntaxException: Person is not mapped
- org.hibernate.hql.internal.ast.QuerySyntaxException: Admin is not mapped [from Admin where username=
- nested exception is org.hibernate.hql.ast.QuerySyntaxException: users is not mapped. [from users]
- org.hibernate.hql.internal.ast.QuerySyntaxException: XXXXis not mapped [from XXXX]
- org.hibernate.hql.ast.QuerySyntaxException: UserType is not mapped
- org.hibernate.hql.ast.QuerySyntaxException is not mapped
- org.hibernate.hql.ast.QuerySyntaxException: is not mapped 异常处理