SSH框架开发异常记录:nested exception is org.hibernate.hql.ast.QuerySyntaxException
来源:互联网 发布:java读取log日志文件 编辑:程序博客网 时间:2024/06/06 09:53
org.springframework.orm.hibernate3.HibernateQueryException: AdminUser is not mapped [from AdminUser where username = ? and password = ?]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: AdminUser is not mapped [from AdminUser where username = ? and password = ?]
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:656)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:656)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
关键错误信息在上面的Hibernate无法映射AdminUser这个实体这句话。
那么有哪些情况会造成这个错误呢?
首先我梳理一下hibernate工作原理,把实体类映射到数据库中的表,需要以下几点:
1、实体类
2、映射文件
3、如果是搭配spring,而配置文件又是交由spring容器管理的话,那么也需要在applicationContext.xml中配置
然后开始排查错误,首先看实体类与映射文件是否一致,表名,字段类型等,没有问题,之后看数据库中表结构与映射文件是否匹配,如id增长类型,发现也没问题;
那么就应该是spring的配置文件了,果然是忘了在里面将映射文件交给spring管理。
问题解决
2 0
- SSH框架开发异常记录:nested exception is org.hibernate.hql.ast.QuerySyntaxException
- apfuse2.0.2 nested exception is org.hibernate.hql.ast.QuerySyntaxException: Otacity is not mapped
- nested exception is org.hibernate.hql.ast.QuerySyntaxException: users is not mapped. [from users]
- nested exception is org.hibernate.hql.ast.QuerySyntaxException: Product is not mapped [from Product]
- is not mapped.nested exception is org.hibernate.hql.ast.QuerySyntaxException: user_kissfly
- org.hibernate.hql.ast.QuerySyntaxException: is not mapped 异常总结
- org.hibernate.hql.ast.QuerySyntaxException: is not mapped 异常总结 .
- org.hibernate.hql.ast.QuerySyntaxException is not mapped异常
- org.hibernate.hql.ast.QuerySyntaxException: **** is not mapped 异常总结
- org.hibernate.hql.ast.QuerySyntaxException:is not mapped 异常总结
- org.hibernate.hql.ast.QuerySyntaxException: is not mapped 异常总结
- org.hibernate.hql.ast.QuerySyntaxException:is not mapped 异常总结
- org.hibernate.hql.ast.QuerySyntaxException:is not mapped 异常总结
- org.hibernate.hql.ast.QuerySyntaxException: is not mapped 异常总结
- org.hibernate.hql.ast.QuerySyntaxException is not mapped异常
- org.hibernate.hql.ast.QuerySyntaxException: is not mapped 异常处理
- org.hibernate.hql.ast.QuerySyntaxException is not mapped异常
- org.hibernate.hql.ast.QuerySyntaxException 异常处理
- 白话:XSS攻击(Cross Site Scripting)
- leetcode-9. Palindrome Number
- [Aha]擒贼先擒王
- HttpClient发送http本地测试代码
- D. Jzzhu and Cities
- SSH框架开发异常记录:nested exception is org.hibernate.hql.ast.QuerySyntaxException
- 淘宝数据库OceanBase SQL编译器部分 源码阅读--生成逻辑计划
- android.content.res.Resources$NotFoundException
- Swift NSClassFromString撞的墙
- 在当前ubuntu中编译模块的方法
- 使用RippleDrawable来使UI点击产生水波纹效果
- 运用linux脚本重新发布项目
- 一、SaltStack安装与基础配置
- django基础