<script type="text/javascript"> google_ad_client = "pub-5033576919944123"; google_ad_width = 728; google_ad_height = 90; google_ad_format = "728x90_as"; google_ad_type = "text_image"; //2007-10-24: csdn.blog google_ad_channel = "8548491739"; </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
演示的sqlMap 配置文件,通过'$'和'*'的使用,达到动态映射Table到一个map的作用











也就是在IBatis里面配置一个statment,去执行多个查询,充分利用了map映射的特性.
去执行多个查询。
比如
select * from myexample
select * from mywork
使用"*" 而且没有用resultClass 指定返回
但是在默认配置下,在使用的时候的时候
2次以上传入不同的$dbName$,$tabeName$ 调用这个useAutoResultMapExample,
就要报java.sql.SQLException: Invalid column name错误
因为iBatis自己有 AutoResultMap的cache,尽管你传入的$tableName$不同,但是他总是
用第一个建立的AutoResultMap的cache去匹配以后的$tableName$当然有错误了
解决方法: 使用多个statment或者使用 remapResults="true" (为了效率他默认的是false)
以上由于效率问题,建议还是采用多个statement 映射到不同的model上面去,不建议生产系统也这么使用。
<script type="text/javascript"> google_ad_client = "pub-5033576919944123"; google_ad_width = 728; google_ad_height = 90; google_ad_format = "728x90_as"; google_ad_type = "text_image"; //2007-10-24: csdn.blog google_ad_channel = "8548491739"; </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>