Reputation: 83
I have a select statement which returns list of values of same datatype (VARCHAR). Result is anywhere between 1 to 6 rows.I'm using queryForList()
and storing the response in a List object. When executing I'm getting an error
--- Cause: com.ibatis.sqlmap.client.SqlMapException: No type handler could be found to map the property 'statusList' to the column 'null'. One or both of the types, or the combination of types is not supported.
The SQL query, when executed in a SQL window, returns 3 rows. Could you please assist? Thanks in advance
<resultMap id="retrieveStatusResult"
class="ie.org.model.ResponseBO">
<result property="statusList" columnIndex="1" />
</resultMap>
<select id="retrieveStatus" parameterClass="ie.org.model.RequestBO"
resultMap="retrieveStatusResult">
SELECT (SELECT DESCRIPTION
FROM TABLEA LCD
WHERE LCD.CODE_DETAIL = QPL.STATUS)
FROM TABLEB QPL
WHERE QPL.QUOTE=#Quote#
AND VERSION IN (SELECT VERSION FROM TABLEB WHERE QUOTE = #Quote#)
</select>
ResponseBO.java
private List statusList = new ArrayList();
public List getStatusList() {
return statusList;
}
public void setStatusList(List statusList) {
this.statusList = statusList;
}
Upvotes: 1
Views: 2343
Reputation: 48
You are not mapping the results properly/your bo is wrong.
When you use queryForList()
, you are trying to create a list of the objects you have in your resultMap. And in your BO you are trying to create a list from each row of your query answer.
You should use a BO like this:
private String status;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
which has a proper type for the answer of your query.
To use the results of the query you call your statement like this:
List<ResponseBO> listStatus = new ArrayList<ResponseBO>();
listStatus = (List<ResponseBO>)queryForList("retrieveStatus",properys);
propertys
is a hashmap with your query parameters
Upvotes: 1