Reputation: 340
I want to get a key-pair object from my sql, so how can I make sometime like this
@Query("SELECT id,name FROM table")
HashMap<Integer, String> getValues();
Upvotes: 5
Views: 4327
Reputation: 12005
You better off creating a Pojo to encapsulate your pair, that's the way they do in the samples, which I imagine is the right way to do it.
class POJO {
String name;
int id;
}
@Query("SELECT id,name FROM table")
List<POJO> getValues();
Upvotes: 6