问题描述
- JAVA ibatis的问题 在线急等
-
select *
from (select xsxkb.*,
to_char(SUBSTR(xsxkb.XNXQ, 6, 4) - xxb.DQSZJ),
to_char((SUBSTR(xsxkb.XNXQ, 6, 4) - xxb.DQSZJ) *
(SUBSTR(xsxkb.XNXQ, 6, 4) - xxb.DQSZJ) *
(xsxfyq.YQXF - nvl(xsxfyq.HDXF, 0) - nvl(xsxfyq.BXQWHDXF, 0) -
nvl(XXQXKXF, 0))) as qz from
$xsxkb$ xsxkb ,JWXT.XK_XSXFYQ xsxfyq , jwxt.xj_xxb xxbwhere xsxkb.xkzt = '0' and xsxkb.zt='1' and xsxkb.xh = xsxfyq.xh and xxb.xh = xsxkb.xh and xsxfyq.ZT =1 and xsxfyq.kcxz = (select jxrw.kcxz from jwxt.jw_jxrwb jxrw where jxrw.rwkey=#rwkey#) and xsxkb.rwkey = #rwkey# and ((xsxkb.nj in (select hbb.nj from jwxt.jw_hbb hbb where rwkey = #rwkey#) and (select xxb.zydm from jwxt.xj_xxb xxb where xxb.xh = xsxkb.xh) in (select hbb.zydm from jwxt.jw_hbb hbb where rwkey = #rwkey#)) or jwxt.xk_is_zykc(#rwkey#, xsxkb.xh, (select xxb.zydm from jwxt.xj_xxb xxb where xxb.xh = xsxkb.xh)) = 1 ) order by qz ) </select> 拿出来 --------------------sql map 如上 输出sql 是绝对可以查询出来的 报错如下 2015-07-02 10:26:43,315 [Thread-18] INFO - SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];
--- The error occurred in sqlmap/common/JWXT_XJ_XXB_SqlMap.xml.
--- The error occurred while applying a result map.
--- Check the JWXT_XJ_XXB.getfkzyqz-AutoResultMap.
--- Check the result mapping for the 'QZ' property.
--- Cause: com.ibatis.common.beans.ProbeException: There is no WRITEABLE property named 'XNXQ,6,4)-XXB' in class 'java.lang.Object'; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in sqlmap/common/JWXT_XJ_XXB_SqlMap.xml.
--- The error occurred while applying a result map.
--- Check the JWXT_XJ_XXB.getfkzyqz-AutoResultMap.
--- Check the result mapping for the 'QZ' property.
--- Cause: com.ibatis.common.beans.ProbeException: There is no WRITEABLE property named 'XNXQ,6,4)-XXB' in class 'java.lang.Object'
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:196)
at org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:219)
at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:266)
at com.zk.dao.common.XjXxbDAOImpl.blxkbzyxsXxs(XjXxbDAOImpl.java:228)
at com.zk.business.common.impl.CommonBusinessImpl$2.run(CommonBusinessImpl.java:1740)
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:--- The error occurred in sqlmap/common/JWXT_XJ_XXB_SqlMap.xml.
--- The error occurred while applying a result map.
--- Check the JWXT_XJ_XXB.getfkzyqz-AutoResultMap.
--- Check the result mapping for the 'QZ' property.
--- Cause: com.ibatis.common.beans.ProbeException: There is no WRITEABLE property named 'XNXQ,6,4)-XXB' in class 'java.lang.Object'
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:615)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
at org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:268)
at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:193)
... 4 more
Caused by: com.ibatis.common.beans.ProbeException: There is no WRITEABLE property named 'XNXQ,6,4)-XXB' in class 'java.lang.Object'
at com.ibatis.common.beans.ClassInfo.getSetterType(ClassInfo.java:273)
at com.ibatis.common.beans.ComplexBeanProbe.getPropertyTypeForSetter(ComplexBeanProbe.java:91)
at com.ibatis.common.beans.ComplexBeanProbe.setObject(ComplexBeanProbe.java:216)
at com.ibatis.common.beans.GenericProbe.setObject(GenericProbe.java:90)
at com.ibatis.sqlmap.engine.exchange.ComplexDataExchange.setData(ComplexDataExchange.java:87)
at com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.setResultObjectValues(BasicResultMap.java:373)
at com.ibatis.sqlmap.engine.mapping.statement.RowHandlerCallback.handleResultObject(RowHandlerCallback.java:64)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:382)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:301)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:190)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
... 10 more
解决方案
应该是取别名的字段拿来当字段参数,也要写到resultMap里吧
解决方案二:
怎么写到 resultMap ? 我记得不用写吧 我之前都是直接这样都可以