org.hibernate.hql.ast.QuerySyntaxException: XX is not mapped [from XX]
2017-01-10 15:21
393 查看
原因:
1.检查是否映射文件有问题
2.检查sql语句问题
我的错误例子如下:
session.createQuery("from Roles").list();
createQuery使用hql查询,from Roles 中的Roles 是实体类不是表名。
session.createSQLQuery("select * from roles").addEntity(Roles.class).list();
createSQLQuery使用hql或sql查询,roles是表名。
参考文章
xxx is not mapped [from xx] http://669341085.iteye.com/blog/858572
createSQLQuery() 与 createQuery() 区别 http://blog.csdn.net/gs313874233/article/details/7480224
1.检查是否映射文件有问题
2.检查sql语句问题
我的错误例子如下:
session.createQuery("from Roles").list();
createQuery使用hql查询,from Roles 中的Roles 是实体类不是表名。
session.createSQLQuery("select * from roles").addEntity(Roles.class).list();
createSQLQuery使用hql或sql查询,roles是表名。
参考文章
xxx is not mapped [from xx] http://669341085.iteye.com/blog/858572
createSQLQuery() 与 createQuery() 区别 http://blog.csdn.net/gs313874233/article/details/7480224
相关文章推荐
- org.hibernate.hql.ast.QuerySyntaxException: XX is not mapped [from XX]
- org.hibernate.hql.ast.QuerySyntaxException: XX is not mapped [from XX]
- org.hibernate.hql.ast.QuerySyntaxException: XX is not mapped [from XX]
- org.hibernate.hql.ast.QuerySyntaxException: XX is not mapped [from XX]
- org.hibernate.hql.ast.QuerySyntaxException:XX is not mapped
- org.hibernate.hql.ast.QuerySyntaxException: XX is not mapped
- org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User]
- org.hibernate.hql.ast.QuerySyntaxException: Category is not mapped [from Category]
- org.hibernate.hql.internal.ast.QuerySyntaxException: Admin is not mapped [from Admin where username=
- spring&org.hibernate.hql.ast.QuerySyntaxException: XX is not mapped !
- org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User] 异常总结
- org.hibernate.hql.ast.QuerySyntaxException: XX is not mapped !
- SSH报错:org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [select o from User o where 1=1
- org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User].
- org.hibernate.hql.internal.ast.QuerySyntaxException: userinfo is not mapped [from userinfo u where u
- 关于org.hibernate.hql.ast.QuerySyntaxException: 关键字命名的类 is not mapped [from 关键字命名的类 ]
- org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User] 异常总结
- 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]
- Hibernate中运行程序时报错:org.hibernate.hql.internal.ast.QuerySyntaxException: apibasic is not mapped [from