日期:2014-05-16  浏览次数:20528 次

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.Refle