简体   繁体   English

MyBatis查询结果在HashMap中?

[英]MyBatis query result in a HashMap?

For the below query, 对于以下查询,

 SELECT 
     MSGS.MSGTYPE,
     count(*) as NOOFRECORDS 
 FROM 
     SCHEMA.MESSAGES MSGS
 GROUP BY 
     MSGS.MSGTYPE

What would be the equivalent in MyBatis mapper so that I can get a Result as a HashMap with MSGS.MSGTYPE as the key and NOOFRECORDS as the value ? 什么是MyBatis映射器中的等价物,以便我可以将结果作为HashMap获取,其中MSGS.MSGTYPE作为键,NOOFRECORDS作为值?

<select id="selectAllCategories" resultType="hashmap">
 select id, name from categories  
</select>

and More details here 这里有更多细节

Stack Answer 堆栈答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM