通过hibernate连接db2数据库利用get方法返回数据时出错!!!
代码走到此处的时候:PersonReg personReg = (PersonReg)dao.get(PersonReg.class, list.get(0).toString());
报错,求高手相助!!!!!
错误提示:如下--------------------------------
javax.xml.ws.soap.SOAPFaultException: Hibernate operation: could not load an entity: [ie.cphh.services.model.PersonReg#1]; uncategorized SQLException for SQL [select personreg0_.PERSONREG_ID as PERSONREG1_15_0_, personreg0_.HR_ID as HR2_15_0_, personreg0_.NAME as NAME15_0_, personreg0_.MEDICARE_CD as MEDICARE4_15_0_, personreg0_.MEDICAL_INSURANCE_NO as MEDICAL5_15_0_, personreg0_.ID_NO_CD as ID6_15_0_, personreg0_.ID_NO as ID7_15_0_, personreg0_.ID_NO_START_DATE as ID8_15_0_, personreg0_.ID_NO_CANCEL_DATE as ID9_15_0_, personreg0_.ID_PROVIDING_ORG_CODE as ID10_15_0_, personreg0_.BIRTH_DATE as BIRTH11_15_0_, personreg0_.GENDER_CD as GENDER12_15_0_, personreg0_.NATIONALITY_CD as NATIONA13_15_0_, personreg0_.NATION_CD as NATION14_15_0_, personreg0_.MARITAL_ST_CD as MARITAL15_15_0_, personreg0_.WORK_DATE as WORK16_15_0_, personreg0_.OCCU_TYPE_CD as OCCU17_15_0_, personreg0_.ED_BG_CD as ED18_15_0_, personreg0_.AR_CD as AR19_15_0_, personreg0_.AD_CD as AD20_15_0_, personreg0_.PROVINCE_NAME as PROVINCE21_15_0_, personreg0_.CITY_NAME as CITY22_15_0_, personreg0_.AREA_NAME as AREA23_15_0_, personreg0_.STREET_ID as STREET24_15_0_, personreg0_.VILLAGE_NAME as VILLAGE25_15_0_, personreg0_.HOUSE_NO as HOUSE26_15_0_, personreg0_.POST_CD as POST27_15_0_, personreg0_.TEL_TYPE_CD as TEL28_15_0_, personreg0_.TEL_NO as TEL29_15_0_, personreg0_.EMAIL_AD as EMAIL30_15_0_, personreg0_.LINKMAN_NAME as LINKMAN31_15_0_, personreg0_.linkman_rel_cd as linkman32_15_0_, personreg0_.lm_Id_no_cd as lm33_15_0_, personreg0_.lm_Id_no as lm34_15_0_, personreg0_.Register_date as Register35_15_0_, personreg0_.Recorder_name as Recorder36_15_0_, personreg0_.REGISTER_PERSON_CODE as REGISTER37_15_0_, personreg0_.REGISTER_ORG_CODE as REGISTER38_15_0_, personreg0_.SEND_TIME as SEND39_15_0_, personreg0_.SEND_ORG_CODE as SEND40_15_0_, personreg0_.SEND_SYSTEM as SEND41_15_0_, personreg0_.CREATETIME as CREATETIME15_0_, personreg0_.LastUpTime as LastUpTime15_0_, personreg0_.STATE as STATE15_0_ from PERSONREG personreg0_ where personreg0_.PERSONREG_ID=?]; SQL state [null]; error code [-4220]; [jcc][1093][10427][3.62.56] 数据转换无效:参数实例 101 对于所请求的转换为 java.sql.Timestamp 的转换无效。 ERRORCODE=-4220, SQLSTATE=null; nested exception is com.ibm.db2.jcc.am.SqlException: [jcc][1093][10427][3.62.56] 数据转换无效:参数实例 101 对于所请求的转换为 java.sql.Timestamp 的转换无效。 ERRORCODE=-4220, SQLSTATE=null
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:146)
at $Proxy39.verifyPersonHH(Unknown Source)
at ie.cphh.services.TestClentVerifyPerson.main(TestClentVerifyPerson.java:27)
Caused by: org.apache.cxf.binding.soap.SoapFault: Hibernate operation: could not load an entity: [ie.cphh.services.model.PersonReg#1]; uncategorized SQLException for SQL [select personreg0_.PERSONREG_ID as PERSONREG1_15_0_, personreg0_.HR_ID as HR2_15_0_, personreg0_.NAME as NAME15_0_, personreg0_.MEDICARE_CD as MEDICARE4_15_0_, personreg0_.MEDICAL_INSURANCE_NO as MEDICAL5_15_0_, personreg0_.ID_NO_CD as ID6_15_0_, personreg0_.ID_NO as ID7_15_0_, personreg0_.ID_NO_START_DATE as ID8_15_0_, personreg0_.ID_NO_CANCEL_DATE as ID9_15_0_, personreg0_.ID_PROVIDING_ORG_CODE as ID10_15_0_, personreg0_.BIRTH_DATE as BIRTH11_15_0_, personreg0_.GENDER_CD as GENDER12_15_0_, personreg0_.NATIONALITY_CD as NATIONA13_15_0_, personreg0_.NATION_CD as NATION14_15_0_, personreg0_.MARITAL_ST_CD as MARITAL15_15_0_, personreg0_.WORK_DATE as WORK16_15_0_, personreg0_.OCCU_TYPE_CD as OCCU17_15_0_, personreg0_.ED_BG_CD as ED18_15_0_, personreg0_.AR_CD as AR19_15_0_, personreg0_.AD_CD as AD20_15_0_, personreg0_.PROVINCE_NAME as PROVINCE21_15_0_, personreg0_.CITY_NAME as CITY22_15_0_, personreg0_.AREA_NAME as AREA23_15_0_, personreg0_.STREET_ID as STREET24_15_0_, personreg0_.VILLAGE_NAME as VILLAGE25_15_0_, personreg0_.HOUSE_NO as HOUSE26_15_0_, personreg0_.POST_CD as POST27_15_0_, personreg0_.TEL_TYPE_CD as TEL28_15_0_, personreg0_.TEL_NO as TEL29_15_0_, personreg0_.EMAIL_AD as EMAIL30_15_0_, personreg0_.LINKMAN_NAME as LINKMAN31_15_0_, personreg0_.linkman_rel_cd as linkman32_15_0_, personreg0_.lm_Id_no_cd as lm33_15_0_, personreg0_.lm_Id_no as lm34_15_0_, personreg0_.Register_date as Register35_15_0_, personreg0_.Recorder_name as Recorder36_15_0_, personreg0_.REGISTER_PERSON_CODE as REGISTER37_15_0_, personreg0_.REGISTER_ORG_CODE as REGISTER38_15_0_, personreg0_.SEND_TIME as SEND39_15_0_, personreg0_.SEND_ORG_CODE as SEND40_15_0_, personreg0_.SEND_SYSTEM as SEND41_15_0_, personreg0_.CREATETIME as CREATETIME15_0_, personreg0_.LastUpTime as LastUpTime15_0_, personreg0_.STATE as STATE15_0_ from PERSONREG personreg0_ where personreg0_.PERSONREG_ID=?]; SQL state [null]; error code [-4220]; [jcc][1093][10427][3.62.56] 数据转换无效:参数实例 101 对于所请求的转换为 java.sql.Timestamp 的转换无效。 ERRORCODE=-4220, SQLSTATE=null; nested exception is com.ibm.db2.jcc.am.SqlException: [jcc][1093][10427][3.62.56] 数据转换无效:参数实例 101 对于所请求的转换为 java.sql.Timestamp 的转换无效。 ERRORCODE=-4220, SQLSTATE=null
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:75)
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:46)
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:35)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:99)
at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:700)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2261)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2134)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1988)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:639)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:487)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
... 2 more
[解决办法]
数据类型都是什么
数据转换无效:参数实例 101 对于所请求的转换为 java.sql.Timestamp 的转换无效。 ERRORCODE=-4220, SQLSTATE=null
[解决办法]
数据类型转换不了 java.sql。Timestamp 类型。
你看看数据库是什么类型的。
时间的话,用varchar类型吧。