는 iBATIS를 2.3 사용하여 일부 코드가, 다음과 같이 I 클래스 사용자와 된 resultMap을 가지고 : 그런쿼리가 Ibatis의 resultMap에 대한 결과 중 일부만 리턴 할 수 있습니까?
<select id="getUserId" resultMap="userResultMap">
select id from Foo
</select>
:
다음public class User {
private Integer id;
private String name;
public Integer getId() {
return this.id;
}
public void setId(final Integer id) {
this.id = id;
}
public String getName() {
return this.name;
}
public void setName(final String name) {
this.name = name;
}
}
<resultMap id="userResultMap" class="user">
<result property="id" column="id"/>
<result property="name" column="name"/>
</resultMap>
난 단지 ID를 반환하는 선택 쿼리를
--- The error occurred in ibatis/user.xml.
--- The error occurred while applying a result map.
--- Check the user.userResultMap.
--- Check the result mapping for the 'name' property.
--- Cause: java.sql.SQLException: Column 'name' not found.
그것을 가지고 어떻게 든 가능 : iBatis를가 된 resultMap의 모든 결과와 "이름"이이 전송 쿼리 오류에 의해 반환되지 않기 때문에 기입하고 싶어 resultMap에서 결과의 일부만 반환하는 쿼리? 당신은 당신의 질의에 "이름"을 누락
<select id="getUserId" resultMap="userResultMap">
select id, name from Foo
</select>
mybatis 측의 문제가 아닙니다. 'name'이라는 이름의 열이 있는지 확인하십시오. –
쿼리가 'name'열을 반환하지 않습니다. 정확히 그 문제입니다. 쿼리를 변경할 수 없으며, 다른 사용자가 소유하고 있으며 사실 Oracle에서 프로 시저를 호출 한 것입니다. 후는 테이블이 아닙니다. 'select id from app.getid() ...' – Francisco
그런 다음 mybatis가 'name'열이있는 테이블을 찾을 수 없으므로 resultmap에서 속성을 제거해야합니다. –