HI:
I hava solved it by reconfig the sqlMapConfig
file~~
Before:
<sqlMapConfig>
<sqlMap resource="sqlmap-Test.xml"/>
<sqlMap resource="sqlmap-global.xml"/>
</sqlMapConfig>
<sqlMap resource="sqlmap-Test.xml"/>
<sqlMap resource="sqlmap-global.xml"/>
</sqlMapConfig>
After:
<sqlMapConfig>
<sqlMap resource="sqlmap-global.xml"/>
<sqlMap resource="sqlmap-global.xml"/>
<sqlMap
resource="sqlmap-Test.xml"/>
</sqlMapConfig>
</sqlMapConfig>
xinyu
发件人: 张鑫宇 [mailto:[EMAIL PROTECTED]
发送时间: 2005年12月30日 17:13
收件人: [email protected]
主题: About reuse SQL-fragments ??
重要性: 高
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
