求高手帮忙解决:关于Hibernate!!!!!!!!(历来都是当天结贴)

nikefly 2008-01-03 09:17:41
HTTP Status 500 -

--------------------------------------------------------------------------------
哪个高手能帮小弟解决啊,感谢不尽!小弟刚开始学,不太懂,这个问题困扰了我快两天了,还没解决....



type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: org.hibernate.hql.ast.QuerySyntaxException: Department is not mapped. [from Department]
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:532)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:426)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
com.jspdev.ch18.EncodingFilter.doFilter(EncodingFilter.java:29)


root cause

org.hibernate.hql.ast.QuerySyntaxException: Department is not mapped. [from Department]
org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:157)
org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:87)
org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:70)
org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:265)
org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3049)
org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2938)
org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:218)
org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:158)
org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:109)
org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:75)
org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:54)
org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1583)
com.jspdev.ch18.Department.getDepartments(Department.java:57)
org.apache.jsp.createEmployee_jsp._jspService(createEmployee_jsp.java:100)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
com.jspdev.ch18.EncodingFilter.doFilter(EncodingFilter.java:29)


root cause

Department is not mapped.
org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:157)
org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:87)
org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:70)
org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:265)
org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3049)
org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2938)
org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:218)
org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:158)
org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:109)
org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:75)
org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:54)
org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1583)
com.jspdev.ch18.Department.getDepartments(Department.java:57)
org.apache.jsp.createEmployee_jsp._jspService(createEmployee_jsp.java:100)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
com.jspdev.ch18.EncodingFilter.doFilter(EncodingFilter.java:29)
...全文
251 点赞 收藏 10
写回复
10 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
mingnjintian 2009-03-17
如果在你的映射文件没有问题而且已经加入了hibernate.cfg.xml的情况下,还是出现以上错误,则说明你的HQL语句中对应的model有错误,记着尽量给他加上包名。。。这样可以确保万无一失。。。
回复
nikefly 2008-01-04
感谢大家~~
回复
changjiangzhibin 2008-01-03
LZ,在大本营可不能乱讲噢
饭可以...
回复
xxdjnl 2008-01-03
@%@&@&@&@&&@**!!(
回复
w39509027 2008-01-03
不知道你的应用中还有没有其它的东西,也不知道你的设计是什么,之间有什么关系呀!!
回复
nikefly 2008-01-03
汗~~~~~~~~一句话引发的血案>>>>
   SORRY  无心之话,包含包含
回复
yztommyhc 2008-01-03
问问题就问问题,挑衅干什么???!!!!
回复
nikefly 2008-01-03
感谢楼上的兄弟!!!!
 莫非只有你一个懂这个的????回答的有分啊!!!!
回复
imA 2008-01-03
提示的很清楚了,Department is not mapped

也就是Department没有映射,没有相应的Department.xml文件吧?

或者是在hibernate.xml中没有将Department.java映射到Department.xml。

好好检查配置文件。
回复
blliy117 2008-01-03
from Department

说明你的 Department这个department.hbm.xml文件未放到mapping中
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2008-01-03 09:17
社区公告
暂无公告