could not read column value from result set: DBID_; Column 'DBID_' not found.

最近做项目,将原来项目中关于jbpm4(流程方面)的功能移到一个新的项目中,在某些查询时候,却发现了下面的问题,我用的数据库是mysql。
执行sql语句时候本来在数据库表中存在的字段,但是执行时候却报不存在,如果不用别名,就正确了,这是为什么?

Hibernate: SELECT  hpi.DBID_ as dbid,hpi.ID_ as pid,m.wwm_workflow_id as mainId,m.wwm_workflow_name as mainName,m.wwm_workflow_version as version,hpi.start_ as createTime,hpi.state_ as state,hpi.ENDACTIVITY_ as endActivity, qv.SWFQVL_PARAM_NAME7 as projectName from JBPM4_HIST_PROCINST hpi  left join tb_b_web_workflow_main m on m.wwm_workflow_key = substring(hpi.ID_,1,instr(hpi.ID_,'.')-1)  left join TB_B_SENSE_WORK_FLOW_QUERY_VAR qv on qv.SWFQVL_WORKFLOW_INSTANTS_ID=hpi.DBID_  left join JBPM4_HIST_VAR hv on hv.HPROCI_=hpi.DBID_ and hv.VARNAME_='work_flow_start_user' where hpi.STATE_ is not null and m.wwm_workflow_id is not null  order by hpi.START_ desc limit ?
2013-03-18 11:16:46,459 WARN  com.mchange.v2.c3p0.impl.NewPooledConnection  425 - [c3p0] A PooledConnection that has already signalled a Connection error is still in use!
2013-03-18 11:16:46,459 WARN  com.mchange.v2.c3p0.impl.NewPooledConnection  426 - [c3p0] Another error has occurred [ java.sql.SQLException: Column 'DBID_' not found. ] which will not be reported to listeners!
java.sql.SQLException: Column 'DBID_' not found.
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)
	at com.mysql.jdbc.ResultSetImpl.findColumn(ResultSetImpl.java:1144)
	at com.mysql.jdbc.ResultSetImpl.getBigDecimal(ResultSetImpl.java:1414)
	at com.mchange.v2.c3p0.impl.NewProxyResultSet.getBigDecimal(NewProxyResultSet.java:3602)
	at org.hibernate.type.BigIntegerType.get(BigIntegerType.java:57)
	at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:184)
	at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:210)
	at org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.extract(CustomLoader.java:497)
	at org.hibernate.loader.custom.CustomLoader$ResultRowProcessor.buildResultRow(CustomLoader.java:443)
	at org.hibernate.loader.custom.CustomLoader.getResultColumnOrRow(CustomLoader.java:340)
	at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:629)
	at org.hibernate.loader.Loader.doQuery(Loader.java:724)
	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
	at org.hibernate.loader.Loader.doList(Loader.java:2228)
	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
	at org.hibernate.loader.Loader.list(Loader.java:2120)
	at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:312)
	at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1722)
	at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
	at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:175)
	at com.sense.workflow.dao.ext.WorkflowExtDAO.findWorkflowList(WorkflowExtDAO.java:267)
	at com.sense.workflow.service.impl.WorkflowServiceImpl.findWorkflowList(WorkflowServiceImpl.java:345)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:50)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
	at $Proxy9.findWorkflowList(Unknown Source)
	at com.sense.workflow.action.MyToDoAction.loadWorkflowList(MyToDoAction.java:571)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:453)
	at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:292)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
	at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
	at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
	at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
	at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
	at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:211)
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
	at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:211)
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
	at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
	at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
	at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:90)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
	at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
	at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
	at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
	at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
	at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
	at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
	at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
	at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:192)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
	at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
	at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
	at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:511)
	at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:432)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at com.sense.core.filter.ExceptionDisposeFilter.doFilter(ExceptionDisposeFilter.java:24)
	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:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	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:291)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	at java.lang.Thread.run(Thread.java:722)
三月 18, 2013 11:16:46 上午 org.hibernate.type.NullableType nullSafeGet
信息: could not read column value from result set: DBID_; Column 'DBID_' not found.
三月 18, 2013 11:16:46 上午 org.hibernate.util.JDBCExceptionReporter logExceptions
警告: SQL Error: 0, SQLState: S0022
三月 18, 2013 11:16:46 上午 org.hibernate.util.JDBCExceptionReporter logExceptions
严重: Column 'DBID_' not found.[/color]


这个问题困扰了我两天,今天终于解决了。其中下面这个帖子中的一个解决方法给了我提示。
他说:这是beanutil里的一个bug,1.8.3已经修正,ReportManagerImpl.java需要改一下,RowSetDynaClass rsdc = new RowSetDynaClass(rs, true, true); 加上第三个参数,true, useColumnLabel,use JDBC column labels instead of the JDBC column names
参考网址: http://www.iteye.com/problems/43436
我的解决方法是:将原来项目中的链接mysql的架包换成更高版本的,结果重新运行项目,再进行查询时,问题解决了。
我用的架包:mysql-connector-java.jar

你可能感兴趣的:(java,mysql,Hibernate)