spring&org.hibernate.hql.ast.QuerySyntaxException: XX is not mapped !
2016-10-19 17:45
375 查看
又遇到 问题了。。。。
org.hibernate.hql.ast.QuerySyntaxException: tab_name is not mapped !
检查了 Entity ,都有注解,而且没有错, Hibernate.cfg.xml 文件也没有配置错,那怎么说 表 没有映射呀
原来是 Hibernate 的机制问题
Hibername 操作数据库是通过对象的
错误:
String sql="select stuId, stuName, stuSex from stu_tab";
正确:
String sql="from Student";
String sql="select stuId, stuName, stuSex from Student where stuId=?";
注意:
这里的 stuId, stuName, stuSex 是属性,Student 是对象的类名
org.hibernate.hql.ast.QuerySyntaxException: tab_name is not mapped !
检查了 Entity ,都有注解,而且没有错, Hibernate.cfg.xml 文件也没有配置错,那怎么说 表 没有映射呀
原来是 Hibernate 的机制问题
Hibername 操作数据库是通过对象的
错误:
String sql="select stuId, stuName, stuSex from stu_tab";
正确:
String sql="from Student";
String sql="select stuId, stuName, stuSex from Student where stuId=?";
注意:
这里的 stuId, stuName, stuSex 是属性,Student 是对象的类名
org.hibernate.hql.ast.QuerySyntaxException: XX is not mapped !
org.hibernate.hql.ast.QuerySyntaxException: XX is not mapped !
相关文章推荐
- org.hibernate.hql.ast.QuerySyntaxException: XX is not mapped !
- org.hibernate.hql.ast.QuerySyntaxException: XX is not mapped hibernate 注解出错
- org.hibernate.hql.ast.QuerySyntaxException: Enroll is not mapped.
- org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User].
- org.hibernate.hql.ast.QuerySyntaxException:is not mapped 异常总结
- Caused by: org.hibernate.hql.ast.QuerySyntaxException: TkltEmpQuitProcess is not mapped. (SSH项目中出现的映射问题)
- org.hibernate.hql.internal.ast.QuerySyntaxException: Exam is not mapped
- org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User] 异常总结
- org.hibernate.hql.ast.QuerySyntaxException is not mapped异常
- nested exception is org.hibernate.hql.ast.QuerySyntaxException: users is not mapped. [from users]
- 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: XXX is not mapped [from XXX]
- apfuse2.0.2 nested exception is org.hibernate.hql.ast.QuerySyntaxException: Otacity is not mapped
- org.hibernate.hql.ast.QuerySyntaxException:user is notmapped
- org.hibernate.hql.ast.QuerySyntaxException: is not mapped
- 关于org.hibernate.hql.ast.QuerySyntaxException: 关键字命名的类 is not mapped [from 关键字命名的类 ]
- org.hibernate.hql.ast.QuerySyntaxException: is not mapped
- org.hibernate.hql.ast.QuerySyntaxException: **** is not mapped 异常总结
- org.hibernate.hql.ast.QuerySyntaxException: myaddressbook is not mapped