不仔细,一个小小的异常,害我调试了几个小时,实在不应该!
异常信息如下:
Hibernate: insert into CDS_CREDITCAREJG_HIS (ID, BBRQ, BZ, ORG, ITEMS, TZHJ, WJZC, WJGZ, WJCJ, WJKY, WJSS, DBDZY, DBBZ, DBXY, DBBZJ, PD, DW, DRRQ, CHECKFLAG) values (default, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
16:38:46,125 WARN JDBCExceptionReporter:77 - SQL Error: -204, SQLState: 42704
16:38:46,125 ERROR JDBCExceptionReporter:78 - DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: DB2ADMIN.CDS_CREDITCAREJG_HIS
16:38:46,156 WARN JDBCExceptionReporter:77 - SQL Error: -727, SQLState: 56098
16:38:46,156 ERROR JDBCExceptionReporter:78 - DB2 SQL error: SQLCODE: -727, SQLSTATE: 56098, SQLERRMC: 2;-204;42704;DB2ADMIN.CDS_CREDITCAREJG_HIS
16:38:46,156 WARN JDBCExceptionReporter:77 - SQL Error: -727, SQLState: 56098
16:38:46,171 ERROR JDBCExceptionReporter:78 - DB2 SQL error: SQLCODE: -727, SQLSTATE: 56098, SQLERRMC: 2;-204;42704;DB2ADMIN.CDS_CREDITCAREJG_HIS
16:39:08,671 ERROR CreditCareJGHisDAO:50 - save failed
org.springframework.dao.InvalidDataAccessResourceUsageException: could not insert: [com.fenet.gddb.cds.model.datareenter.CreditCareJGHis]; nested exception is org.hibernate.exception.SQLGrammarException: could not insert: [com.fenet.gddb.cds.model.datareenter.CreditCareJGHis]
Caused by:
org.hibernate.exception.SQLGrammarException: could not insert: [com.fenet.gddb.cds.model.datareenter.CreditCareJGHis]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:40)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2158)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2638)
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:298)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:519)
at org.springframework.orm.hibernate3.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:635)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
at org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:632)
at com.fenet.gddb.cds.service.datareneter.dao.CreditCareJGHisDAO.save(CreditCareJGHisDAO.java:47)
at com.fenet.gddb.cds.service.datareneter.bs.CreditCareJGHisBS.createCreditCareJG(CreditCareJGHisBS.java:21)
at com.fenet.gddb.cds.web.servlet.ExcelUploadServlet.upLoadCreditCareJG(ExcelUploadServlet.java:199)
at com.fenet.gddb.cds.web.servlet.ExcelUploadServlet.doPost(ExcelUploadServlet.java:86)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.fenet.gddb.cds.web.common.filter.CommonFilter.doFilter(CommonFilter.java:37)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
Caused by: com.ibm.db2.jcc.c.SqlException: DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: DB2ADMIN.CDS_CREDITCAREJG_HIS
at com.ibm.db2.jcc.c.fg.e(fg.java:1596)
at com.ibm.db2.jcc.c.fg.a(fg.java:1206)
at com.ibm.db2.jcc.b.gb.g(gb.java:140)
at com.ibm.db2.jcc.b.gb.a(gb.java:39)
at com.ibm.db2.jcc.b.w.a(w.java:34)
at com.ibm.db2.jcc.b.vb.g(vb.java:139)
at com.ibm.db2.jcc.c.fg.n(fg.java:1177)
at com.ibm.db2.jcc.c.gg.eb(gg.java:1862)
at com.ibm.db2.jcc.c.gg.d(gg.java:2295)
at com.ibm.db2.jcc.c.gg.W(gg.java:457)
at com.ibm.db2.jcc.c.gg.executeUpdate(gg.java:440)
at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:73)
at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:33)
... 43 more
最后才发现,
原来是Hibernate 的Mapping文档写错了,数据库里根本没有DB2ADMIN.CDS_CREDITCAREJG_HIS这张表,表名本来应该是DB2ADMIN.CDS_CREDITCAREJG_HISTORY....
本文记录了一次因Hibernate配置文件中表名书写错误导致的异常情况,详细展示了错误日志及定位问题的过程。
3413

被折叠的 条评论
为什么被折叠?



