I am creating an ibatis quesry that its result should be :
Map<String,CustomData>
My ibatis query:
<resultMap id="dataMap" class="java.util.HashMap">
<result property="key" column="UUID"/>
<result property="value" resultMap ="customData"/>
</resultMap>
<resultMap id="customData" class="com.model.CustomData">
<result property="x" column="X_COL"/>
</resultMap>
<select id="fetchData"
resultClass="java.util.HashMap"
parameterClass="java.util.Map">
SELECT
UUID AS UUID,
(CASE
WHEN SOME_DATA IS NOT NULL THEN 'TRUE'
END) AS X_COL
FROM TABLE
</select>
CustomData is a java class:
public class CustomData{
private String x;
//Getters & Setters
}
I expect to get the following on the Java:
Map<String,CustomData>
However I get the following:
Map<String,String>
Any ideas !
You should try to replace the
resultClassattribute in yourselecttag by aresultMapwith a"dataMap"value like this :In your case the
queryForListmethod try to instanciate ajava.util.HashMapinstead of this, it should use thedataMapmapping you defined above.