当有几千个结果时,通过Ormlite DAO查询数据时遇到问题.
码:
List pl = db.getPointsDAO().queryBuilder().where().
eq("route_id", croute).query();
当我想得到一个大的点列表List< Point>当前路线croute我需要等待40秒才能获得40.000分.
其中Point.class是:
@DatabaseTable(tableName = "points")
public class Point extends BaseEntity {
@DatabaseField(generatedId = true)
private Integer point_id;
@DatabaseField(canBeNull = false)
...
@DatabaseField(canBeNull = false)
private Double dose;
@DatabaseField(dataType=DataType.DATE_STRING, format="yyyy-MM-dd HH:mm:ss")
public Date date;
@DatabaseField(canBeNull=true,foreign=true)
private Route route;
public Point() {
super();
};
... ...
}
和Route.class是:
@DatabaseTable(tableName = "routes")
public class Route extends BaseEntity {
@DatabaseField(generatedId = true)
private Integer route_id;
@DatabaseField(canBeNull = true)
private String name;
@ForeignCollectionField(eager = false)
ForeignCollection points;
public Route() {
super();
}
... ...
}
一些想法我做错了什么?
谢谢,
托尼