XML Element: resultMap
This element represents the mapping of the columns in the result set. This by itself is a parent and has child element called result under it. Every result element is a single column's mapping information. The typical attributes that are available for a resultMap are –as follows:
Key | Relation Type | Purpose |
---|---|---|
id | Attribute | This is the unique ID with which this Result map is identified within the Logical Data Source. |
class | Attribute | This is the java Class to which this result is going to be mapped into. This means that one record in the result set of the query will be mapped to one object of this class. |
result | Child Element | There has to be one or more result element within a resultMap. |
The following code segment is a sample resultMap definition:
<resultMap id="MY_ENTITY_RESULT_MAP" class="java.util.HashMap"> <result property="ATTR1" nullValue="" column="COL_ATTR1" javaType="java.lang.String" jdbcType="VARCHAR"/> <result property="ATTR2" nullValue="" column="COL_ATTR2" javaType="java.lang.String" jdbcType="VARCHAR"/> </resultMap>
Â