论坛首页 Java企业应用论坛

hibernte 的 nullpointedexception 问题

浏览 3815 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2004-02-28  
我在做hibernate的时候,碰到下面的问题,主要是 oracle库表中的display_sort 字段有值为null的:

net.sf.hibernate.PropertyAccessException: exception setting property value with

CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter

of ynt43.dao.K_STAFF.setDisplay_sort

at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(

Abstract Entity Persister?.java:213)

at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:2

174)

at net.sf.hibernate.loader.Loader.doQuery(Loader.java:240)

at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections

(Loader.java:133)

at net.sf.hibernate.loader.Loader.doList(Loader.java:950)

at net.sf.hibernate.loader.Loader.list(Loader.java:941)

at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:834)

at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1512)

at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1491)

at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1483)

at ynt43.login.db.LoginDB.login(LoginDB.java:35)

at ynt43.login.struts.LoginAction.execute(LoginAction.java:53)

at org.apache.struts.action.RequestProcessor.processActionPerform(Reques

tProcessor.java:484)

at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja

va:274)

at org.apache.struts.action.ActionServlet.process(ActionServlet.java:148

2)

at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl

icationFilterChain.java:284)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF

ilterChain.java:204)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV

alve.java:257)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv

eContext.java:151)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav

a:567)

at org.apache.catalina.core.StandardContextValve.invokeInternal(Standard

Context Valve?.java:245)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV

alve.java:199)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv

eContext.java:151)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav

a:567)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j

ava:184)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv

eContext.java:151)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j

ava:164)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv

eContext.java:149)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav

a:567)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal

ve.java:156)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv

eContext.java:151)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav

a:567)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)

at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:20

6)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java

:833)

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce

ssConnection(Http11Protocol.java:732)

at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java

:619)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP

ool.java:688)

at java.lang.Thread.run(Thread.java:534)

Caused by: net.sf.cglib.beans.BulkBeanException

at ynt43.dao.K_STAFF$$BulkBeanByCGLIB$$ea9a31be.setPropertyValues(<gener

ated>)

at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(

Abstract Entity Persister?.java:208)

... 41 more

Caused by: java.lang.NullPointerException

... 43 more
   发表时间:2004-02-28  
不要在两个版面发同样的贴子,你这是第二次了
0 请登录后投票
   发表时间:2004-02-28  
yehs220 写道
不要在两个版面发同样的贴子,你这是第二次了

收到,版主,帮忙解决一下这个问题吧
0 请登录后投票
   发表时间:2004-02-29  
说过多次的问题了,基本类型的属性无法处理字段为null的情况
解决办法--改用相应的包装类(比如int-->java.lang.Integer)
0 请登录后投票
   发表时间:2004-02-29  
感谢 yehs220,问题已解决 !
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics