2 liuxiaoyi216 liuxiaoyi216 于 2013.09.30 16:49 提问

ibaties启动报错 t.SqlMapException: Unrecognized parameter mapping field

ibaties 启动报错:
Caused by: org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [configs/ibatis/sqlMapConfig.xml]; nested exception is com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMap/select'. Cause: com.ibatis.sqlmap.client.SqlMapException: Unrecognized parameter mapping field: 'RO2CR.ROLE_OBJ_RULE_ID' in
union all
SELECT RO2CR.CFG_RULE_ID,RO2CR.ROLE_OBJ_RULE_ID,NULL REQ_OBJ_RELA_ID,RIC.REQ_ITEM_CFG_ID,'1' TYPE
FROM ROLE_OBJ_2_CFG_RULE RO2CR, CFG_RULE CR,CFG_RULE_2_ITEM_CFG CR2IC,REQ_ITEM_CFG RIC
WHERE RO2CR.CFG_RULE_ID = CR.CFG_RULE_ID AND CR2IC.CFG_RULE_ID=CR.CFG_RULE_ID
AND RIC.REQ_ITEM_CFG_ID=CR2IC.REQ_ITEM_CFG_ID
and cr.ppm_seq =

at org.springframework.orm.ibatis.SqlMapClientFactoryBean.buildSqlMapClient(SqlMapClientFactoryBean.java:341)
at org.springframework.orm.ibatis.SqlMapClientFactoryBean.afterPropertiesSet(SqlMapClientFactoryBean.java:291)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
... 37 more

源码:

<![CDATA[

SELECT RO2CR.CFG_RULE_ID,RO2CR.ROLE_OBJ_RULE_ID,RO2IC.REQ_OBJ_RELA_ID,RO2IC.REQ_ITEM_CFG_ID,'0' TYPE
FROM ROLE_OBJ_2_CFG_RULE RO2CR, CFG_RULE CR,REQ_OBJ_RELA ROR,REQ_OBJ_2_ITEM_CFG RO2IC,REQ_ITEM_CFG RIC
WHERE RO2CR.CFG_RULE_ID = CR.CFG_RULE_ID AND ROR.CFG_RULE_ID=CR.CFG_RULE_ID
AND ROR.REQ_OBJ_RELA_ID=RO2IC.REQ_OBJ_RELA_ID AND RIC.REQ_ITEM_CFG_ID=RO2IC.REQ_ITEM_CFG_ID
and cr.ppm_seq = #seq#
and ro2cr.offer_role_id = #offerRoleId:DECIMAL
and ror.obj_id=#objId#
union all
SELECT RO2CR.CFG_RULE_ID,RO2CR.ROLE_OBJ_RULE_ID,NULL REQ_OBJ_RELA_ID,RIC.REQ_ITEM_CFG_ID,'1' TYPE
FROM ROLE_OBJ_2_CFG_RULE RO2CR, CFG_RULE CR,CFG_RULE_2_ITEM_CFG CR2IC,REQ_ITEM_CFG RIC
WHERE RO2CR.CFG_RULE_ID = CR.CFG_RULE_ID AND CR2IC.CFG_RULE_ID=CR.CFG_RULE_ID
AND RIC.REQ_ITEM_CFG_ID=CR2IC.REQ_ITEM_CFG_ID
and cr.ppm_seq = #seq#
and ro2cr.offer_role_id = #offerRoleId:DECIMAL
and ric.item_spec_id=#itemSpecId#
]]>







怎么就报错了啊,是不是不能用union进行拼接,union 下面的SQL去掉就不报错了,不知道咋回事啊!!!!

1个回答

liuxiaoyi216
liuxiaoyi216   2013.09.30 16:57
已采纳

日 知道了。是sql的格式不对,害的我搞了3个小时。

and ro2cr.offer_role_id = #offerRoleId:DECIMAL

少了个# 号

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!