当有几千个结果时,通过 Ormlite DAO 查询数据时遇到问题。
代码:
List<Point> pl = db.getPointsDAO().queryBuilder().where().
eq("route_id", croute).query();
当我想获得List<Point> pl
当前路线的大量点时,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<Point> points;
public Route() {
super();
}
... ...
}
一些想法我做错了什么?
谢谢,托尼