Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想从我的 sql 中获取一个密钥对对象,所以我怎样才能像这样
@Query("SELECT id,name FROM table") HashMap<Integer, String> getValues();
您最好创建一个 Pojo 来封装您的配对,这就是他们在示例中所做的方式,我认为这是正确的方式。
class POJO { String name; int id; } @Query("SELECT id,name FROM table") List<POJO> getValues();