liuxiaoyi216
liuxiaoyi216
2013-09-30 08:49
采纳率: 100%
浏览 4.7k
已采纳

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 08:57
    已采纳

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

    and ro2cr.offer_role_id = #offerRoleId:DECIMAL

    少了个# 号

    点赞 评论

相关推荐