我是SugarORM的新手,我试图保存一条记录。

Report report = new Report(SessionManager.getInstance().getUserid(),
                           assessmentContainer.getAssessmentTitle(),
                           getDateTimeNow(), response);
report.save();


在SugarORM给出的快速指南中,它似乎包含上下文,但是我不知道如何包含我的上下文,它与我的Report构造函数有某种冲突,因此我忽略了它。

看起来好像成功完成了,但是效率低下。知道有什么问题吗?看下面我的日志。

02-01 14:10:32.736      903-903/com.usrs.jiarong.musrs I/Sugar﹕ on create
02-01 14:10:33.136      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.136      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.136      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.136      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.136      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.166      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.166      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.166      903-903/com.usrs.jiarong.musrs I/Sugar﹕ create table
02-01 14:10:33.166      903-903/com.usrs.jiarong.musrs D/Sugar﹕ Fetching properties
02-01 14:10:33.166      903-903/com.usrs.jiarong.musrs I/Sugar﹕ creating table REPORT
02-01 14:10:33.176      903-903/com.usrs.jiarong.musrs I/Sugar﹕ Report saved : 1
02-01 14:10:33.196      903-903/com.usrs.jiarong.musrs I/Choreographer﹕ Skipped 30 frames!  The application may be doing too much work on its main thread.

最佳答案

在sugarorm的第一次启动时,它必须为数据库生成模型。确保使用所需的表在包中指定了DOMAIN_PACKAGE_NAME。

09-30 23:29