(1)sqlmap配置
<sqlMap namespace="PetitionLetter">
? <typeAlias alias="PetitionLetter" type="com.cs.jfb.input.model.PetitionLetter"/>
? <typeAlias alias="ProcessFlow" type="com.cs.jfb.process.model.ProcessFlow"/>
? <typeAlias alias="Reporter" type="com.cs.jfb.input.model.Reporter"/>
? <typeAlias alias="LetterInformation" type="com.cs.jfb.input.model.LetterInformation"/>
? <typeAlias alias="Supervision" type="com.cs.jfb.supervision.model.Supervision"/>
?
? <resultMap id="PetitionLetterResult" class="PetitionLetter">
? ? <result property="id" column="id"/>
? ? <result property="identifier" column="identifier"/>
? ? <result property="reporter" column="reporter" select="selectReporter"/>
? </resultMap>
?
? <!-- Select with no parameters using the result map for Account class. -->
? <select id="selectAllPetitionLetter" resultMap="PetitionLetterResult">
? ? select * from t_petitionletter
? </select>
?
? <select id="selectReporter" resultClass="Reporter" parameterClass="int">
? select * from t_reporter where id = #id#
? </select>
</sqlMap>
?
(2)问题解决前:
依赖jar:
ibatis-sqlmap-2.3.4.726.jar
?
(3)出现问题
子查询selectReporter不执行,官方文档说是ibatis-common.jar和ibatis-sqlmap.jar是必需的,
但maven上搜罗半天,没有找到ibatis-common-2.3.4.726.jar,后经过比较,
发现ibatis-sqlmap-2.3.4.726.jar 和 ibatis2-sqlmap-2.1.7.597.jar的内容很像,
故用ibatis2-sqlmap-2.1.7.597.jar代替ibatis-common.jar, 问题解决(^_^)!
?
(4)问题解决后:
依赖jar:
ibatis-sqlmap-2.3.4.726.jar(感觉像是mave网站上对ibatis-common.jar进行了升级)
ibatis2-sqlmap-2.1.7.597.jar