KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Using annotations in mybatis, can we have return type as normal map ? Basically, I want something like this @Select("select a, b from tableA") public Map<String, String> getItems(); Where mysql> select * from tableA; +------+------+ | a | b | +------+------+ | 1 | a | | 2 | b | | 3 | c | +------+------+ mysql> desc tableA; +-------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+-------+ | a | varchar(10) | YES | | NULL | | | b | varchar(10) | YES | | NULL | | +-------+-------------+------+-----+---------+-------+ Tried this @Select("select a, b from tableA") @MapKey("a) public Map<String, String> getItems(); but it's giving below exception ### Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'a' in 'class java.lang.String'
Tags (comma-separated)
Save Edits
Cancel