Have a problem with querying data via Ormlite DAO, when there are few thousand results.
Code:
List<Point> pl = db.getPointsDAO().queryBuilder().where().
eq("route_id", croute).query();
When I want to get a large list of points List<Point> pl
for current Route croute
I have to wait like 40 sec for 40.000 points.
where Point.class is:
@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();
};
... ...
}
and Route.class is:
@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();
}
... ...
}
Some ideas what I'm doing wrong?
Thanks,
Toni
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…