当有许多记录时,ORMLite IllegalStateException

时间:2014-11-27 15:55:50

标签: android ormlite

我正在使用queryBuilder以及在哪里进行选择。这是一个POJO表,一般来说很长一段时间以来一直很好地适用于许多用户。

ArrayList<X> result = new ArrayList<X>();
QueryBuilder<X, Integer> queryBuilder = getXDao().queryBuilder();
Where<X, Integer> where = queryBuilder.where();
where.eq(X, x);
queryBuilder.orderBy(X, true);

result = (ArrayList<X>)getXDao().query(queryBuilder.prepare());

由于以下ORMLite异常,每次查询此表时都会有一个特定的崩溃:

java.lang.IllegalStateException: Couldn't read row 1060, col 0 from CursorWindow.  Make sure the Cursor is initialized correctly before accessing data from it.
       at android.database.CursorWindow.nativeGetLong(CursorWindow.java)
       at android.database.CursorWindow.getLong(CursorWindow.java:512)
       at android.database.CursorWindow.getInt(CursorWindow.java:579)
       at android.database.AbstractWindowedCursor.getInt(AbstractWindowedCursor.java:69)
       at com.j256.ormlite.android.AndroidDatabaseResults.getInt(AndroidDatabaseResults.java:169)
       at com.j256.ormlite.field.types.IntegerObjectType.resultToSqlArg(IntegerObjectType.java:37)
       at com.j256.ormlite.field.BaseFieldConverter.resultToJava(BaseFieldConverter.java:24)
       at com.j256.ormlite.field.FieldType.resultToJava(FieldType.java:799)
       at com.j256.ormlite.stmt.mapped.BaseMappedQuery.mapRow(BaseMappedQuery.java:60)
       at com.j256.ormlite.stmt.SelectIterator.getCurrent(SelectIterator.java:270)
       at com.j256.ormlite.stmt.SelectIterator.nextThrow(SelectIterator.java:161)
       at com.j256.ormlite.stmt.StatementExecutor.query(StatementExecutor.java:199)
       at com.j256.ormlite.dao.BaseDaoImpl.query(BaseDaoImpl.java:263)
       at com.j256.ormlite.dao.RuntimeExceptionDao.query(RuntimeExceptionDao.java:213)

我已经在文档中看到过,对于中型或大型表,使用迭代器可能更好。 我的问题是这个数字或行是否会被视为“中等或大”。我原以为不会。我也是 创建大于此的表而不会发现此问题

是否有人建议可能导致此问题或之前看到过类似情况?可能是错误的数据?

0 个答案:

没有答案