---
title: "ibatis-sqlmap-2.3.4.726.jar 级联查询无效的问题解决"
author: "mark_5528"
date: "2012-05-24T16:49:41Z"
tags: []
categories: ["Web前端"]
slug: "ibatis-sqlmap-2-3-4-726-jar"
draft: false
lastmod: "2012-05-24T16:49:41Z"
id: 1539875
url: "https://mark-5528.iteye.com/blog/1539875"
---

(1)sqlmap配置

&lt;sqlMap namespace="PetitionLetter"&gt;

  &lt;typeAlias alias="PetitionLetter" type="com.cs.jfb.input.model.PetitionLetter"/&gt;

  &lt;typeAlias alias="ProcessFlow" type="com.cs.jfb.process.model.ProcessFlow"/&gt;

  &lt;typeAlias alias="Reporter" type="com.cs.jfb.input.model.Reporter"/&gt;

  &lt;typeAlias alias="LetterInformation" type="com.cs.jfb.input.model.LetterInformation"/&gt;

  &lt;typeAlias alias="Supervision" type="com.cs.jfb.supervision.model.Supervision"/&gt;

 

  &lt;resultMap id="PetitionLetterResult" class="PetitionLetter"&gt;

    &lt;result property="id" column="id"/&gt;

    &lt;result property="identifier" column="identifier"/&gt;

    &lt;result property="reporter" column="reporter" select="selectReporter"/&gt;

  &lt;/resultMap&gt;

 

  &lt;!-- Select with no parameters using the result map for Account class. --&gt;

  &lt;select id="selectAllPetitionLetter" resultMap="PetitionLetterResult"&gt;

    select * from t\_petitionletter

  &lt;/select&gt;

 

  &lt;select id="selectReporter" resultClass="Reporter" parameterClass="int"&gt;

  select * from t\_reporter where id = #id#

  &lt;/select&gt;

&lt;/sqlMap&gt;

 

(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