Hi:
The url below said:
The <include>-tag is namespace-aware so you can refer to fragments
even when they are located in another map.
so we write the two sqlMap file
like below:
sqlMap-Test.xml:
<sqlMap
namespace="test">
<select id="query_id" parameterClass="CountableQueryCriteria" resultClass="java.util.HashMap" remapResults="true">
<include refid="global.prefixSql"/>
select * from account_main
<include refid="global.suffixSql"/>
</select>
</sqlMap>
<select id="query_id" parameterClass="CountableQueryCriteria" resultClass="java.util.HashMap" remapResults="true">
<include refid="global.prefixSql"/>
select * from account_main
<include refid="global.suffixSql"/>
</select>
</sqlMap>
sqlMap-Global.xml
<sqlMap
namespace="global">
<sql id="prefixSql">
…………………………
<sql id="prefixSql">
…………………………
</sql>
<sql id="suffixSql">
………………………
<sql id="suffixSql">
………………………
</sql>
</sqlMap>
</sqlMap>
but when i used it i get the
error:
com.paic.pafa.app.lwc.core.beans.factory.BeanCreationException: Error
occurred. Cause: com.ibatis.common.xml.NodeletException: Error parsing
XML. Cause: com.ibatis.common.exception.NestedRuntimeException: Error
parsing XPath '/sqlMapConfig/sqlMap'. Cause:
com.ibatis.common.xml.NodeletException: Error parsing XML. Cause:
com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath
'/sqlMap/select'. Cause:
com.ibatis.common.exception.NestedRuntimeException: Could not find SQL statement
to include with refid 'global.prefixSql'
Caused by: com.ibatis.common.exception.NestedRuntimeException: Could not find SQL statement to include with refid 'global.prefixSql'
Caused by: com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath '/sqlMap/select'. Cause: com.ibatis.common.exception.NestedRuntimeException: Could not find SQL statement to include with refid 'global.prefixSql'
Caused by: com.ibatis.common.exception.NestedRuntimeException: Could not find SQL statement to include with refid 'global.prefixSql'
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath '/sqlMap/select'. Cause: com.ibatis.common.exception.NestedRuntimeException: Could not find SQL statement to include with refid 'global.prefixSql'
Caused by: com.ibatis.common.exception.NestedRuntimeException: Could not find SQL statement to include with refid 'global.prefixSql'
Caused by: com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath '/sqlMap/select'. Cause: com.ibatis.common.exception.NestedRuntimeException: Could not find SQL statement to include with refid 'global.prefixSql'
…………………………
Caused by: com.ibatis.common.exception.NestedRuntimeException: Could not find SQL statement to include with refid 'global.prefixSql'
Caused by: com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath '/sqlMap/select'. Cause: com.ibatis.common.exception.NestedRuntimeException: Could not find SQL statement to include with refid 'global.prefixSql'
Caused by: com.ibatis.common.exception.NestedRuntimeException: Could not find SQL statement to include with refid 'global.prefixSql'
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath '/sqlMap/select'. Cause: com.ibatis.common.exception.NestedRuntimeException: Could not find SQL statement to include with refid 'global.prefixSql'
Caused by: com.ibatis.common.exception.NestedRuntimeException: Could not find SQL statement to include with refid 'global.prefixSql'
Caused by: com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath '/sqlMap/select'. Cause: com.ibatis.common.exception.NestedRuntimeException: Could not find SQL statement to include with refid 'global.prefixSql'
…………………………
help me please!
Thanks,
xinyu
xinyu
