hibernate报NullPointerException,求解答

 我来答
己学好4
2016-04-15 · TA获得超过1.5万个赞
知道大有可为答主
回答量:1.1万
采纳率:91%
帮助的人:5236万
展开全部
String HqlString="select new cn.hnedu.jyjk.vo.OldXjStudent"
+ "(t.yxdm, t.xh, t.xm, t.sfzhm,"
+ " t.byslxdh, t.jtlxdh, t.qq, t.email, "
+ " t.xbdm, t.xldm, t.zydm, t.sfsfbz, t.sfsfbz as sfslbdm, t.pyfsdm, t.xz, t.mzdm, t.zzmmdm, t.rxsj,convert(nvarchar,t.nbynf) as bysj,"
+ " t.zxwyyzdm, t.syszddm, t.remark8 as jtdz, "
+ " t.jtyzbm, t.ksh, t.kslbdm, t.xysbh, t.x as kzx6, t.wpdxdw, t.bjhm,convert(nvarchar,t.stuYear) as kzx8, t.jyknlbdm, "
+ " b.byqxdm, b.bdzqflbdm, b.bdzdwmc as dwmc, b.dwdm, b.bdzdwdzx as dwszddm, b.dwxzdm, b.jylbdm, "
+ " b.jyzkdm, b.bdzbz as kzx1, b.gyname as kzx5, b.zzjgdm as dwzzjg, b.dwhydm, b.zwlbdm as gzzwlbdm, b.gyszdx as sjdwszddm, b.dwlxfs as dwdh, "
+ " b.byzsbh as byzh, b.dajsdwmc as dajsdw, b.dajsdwdzx as dajsdwszd, b.dajsdwyzbm as dajsdwyb, b.dajsdwlxr, b.dajsdwlxdh as dajsdwdh) ";

List<OldXjStudent> oldsList = this.getJyzxByqxLogic().find(HqlString+
" from JyzxJsstudent t,JyzxByqx b where t.xldm=b.xldm and t.stuYear='"
+ this.get_mr_year(jyzxXxuser.getXxdm())
+ "' and t.byszgrz=1 ORDER BY t.bjhm,t.xh");

没做映射文件,直接new 的对象。是将2张有映射的表的数据集合到新对象上。。但是tomat报hibernate里面的一个get构造方法的空指针异常。但是我明明写了构造方法的。没写的话也不是报这个错,是报的没有合适的构造方法这个错啊。求大家帮我看看问题出在哪里?tomat报错如下

Plain Text code?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95

java.lang.NullPointerException
at org.hibernate.util.ReflectHelper.getConstructor(ReflectHelper.java:17
2)
at org.hibernate.hql.ast.tree.ConstructorNode.resolveConstructor(Constru
ctorNode.java:114)
at org.hibernate.hql.ast.tree.ConstructorNode.prepare(ConstructorNode.ja
va:88)
at org.hibernate.hql.ast.HqlSqlWalker.processConstructor(HqlSqlWalker.ja
va:840)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExpr(HqlSqlBaseWalker.
java:1956)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExprList(HqlSqlBaseWal
ker.java:1825)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectClause(HqlSqlBaseWalke
r.java:1394)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:
553)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWa
lker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.j
ava:229)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl
.java:228)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorIm
pl.java:160)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl
.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCa
che.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessio
nImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImp
l.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate
(HibernateTemplate.java:919)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(Hibern
ateTemplate.java:419)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativ
eSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTe
mplate.java:917)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTe
mplate.java:909)
at cn.hnedu.jyjk.dao.impl.JyzxByqxDAO.find(JyzxByqxDAO.java:148)
at cn.hnedu.jyjk.service.impl.JyzxByqxServiceImpl.find(JyzxByqxServiceIm
pl.java:33)
at cn.hnedu.jyjk.web.xx.XxAction.exportByqxDBFtoOldSystem(XxAction.java:
1171)
at cn.hnedu.jyjk.web.xx.XxAction.doExecute(XxAction.java:104)
at cn.hnedu.jyjk.web.XxuserAuditAction.execute(XxuserAuditAction.java:26
)
at org.apache.struts.action.RequestProcessor.processActionPerform(Reques
tProcessor.java:425)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
va:228)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:191
3)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:127)
at org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBin
derValve.java:227)
at org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.j
ava:347)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:293)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)

at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:311)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:776)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.ja
va:705)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSock
et.java:898)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:690)
at java.lang.Thread.run(Thread.java:619)
Kiana灬
2016-04-15 · 超过13用户采纳过TA的回答
知道答主
回答量:41
采纳率:100%
帮助的人:6.6万
展开全部
看异常好像说没有对应的构造方法吧, 你看new xxxxx() 构参的时候参数个数什么的对不对, 还有一些整形数据类型是否有全部匹配。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式