【发布时间】:2019-02-13 11:44:57
【问题描述】:
我想在 Android SDK 环境中通过 Room Library 从 SqlLite 中选择多个列。 下面是选择它的查询。 @Query("SELECT ID,message,timestamp FROM Chat_Message WHERE groupID =:groupID ORDER BY 时间戳 DESC LIMIT 1") 公共列表 get_last_msg_ID_timestamp(字符串 组ID); 我在主类下定义的 Last_Msg_Detail 类如下:- 公共类 Last_Msg_Detail { 公共整数 ID; 公共字符串消息; 公共长时间戳; }
For accessing this three variable have created below method :-
Last_Msg_Detail last_record_t = new Last_Msg_Detail();
public Last_Msg_Detail get_last_msgand_time_stamp(String groupID){
List<Last_Msg_Detail> last_record =
chat_messageDao.get_last_msg_ID_timestamp(groupID);
last_record_t = last_record.get(0);
return last_record_t;
}
On Rebuilding Project, getting follow error
1. error: Cannot figure out how to save this field into database. You can
consider adding a type converter for it.
2. error: Not sure how to convert a Cursor to this method's return type
Kindly advise how to resolve.
提前感谢您的帮助。
【问题讨论】:
标签: android