Sometimes do not want to create javabean, or pollute the existing JavaBean object, you need to return the map type of data objects;
1) The simplest method is to make the query to the field, using "" to cause, so that the map type can be returned;
2) or write Resultmap, to do the mapping of the field is also possible;
Examples are as follows:
1)
<select id= "Queryproductinfo" parameterclass= "Java.util.HashMap" resultclass= "Java.util.HashMap" >
Select A.marketproduct_code "ProductCode",
A.marketproduct_name "ProductName",
A.product_class "Productclass",
(Select T.value_chinese_name
From Product_base_data t
where T.collection_code = ' CPDL '
and T.value_code = a.product_class) "Productclassname",
A.is_combined "Iscombined",
A.combind_relation "PackageType",
A.is_self_card "Isselfcard",
(Select Decode (count (1), 0, ' 0 ', ' 1 ')
From Package_info T1
where t1.id_marketproduct_info = a.id_marketproduct_info) "Haspackage",
A.is_self_card "Productkind",
A.marketproduct_type "ProductType",
B.least_copy_num "Leastinusureamout",
B.top_copy_num "Topinsureamout",
B.insure_period_lmt_of_mon "Periodsetmonth",
B.insure_period_lmt_of_day "Periodsetday",
B.least_accept_insure_age "Leastacceptinusrage",
B.top_accept_insure_age "Topacceptinsurage",
A.target_type "TargetType",
B.profession_type "Professiontype",
B.special_promise "Specialpromise",
A.version "Version"
From Marketproduct_info A,
Marketproduct_rule_param B,
Technic_product_info C
where A.marketproduct_code = #marketproductCode #
and a.version = #version #
and A.id_marketproduct_info = B.id_marketproduct_info (+)
and A.id_technic_product_info = C.id_technic_product_info
</select>
2)
<resultmap id= "Getitemsresult" class= "Java.util.HashMap" >
<result property= "ItemName" column= "Item_name"/>
<result property= "Itemvalue" column= "Item_value"/>
</resultMap>
<select id= "GetItems" resultmap= "Getitemsresult" >
Select Item_name, Item_value from item_table
</select>
Ibatis return Map type data