greenrobot / greenDAO

greenDAO is a light & fast ORM solution for Android that maps objects to SQLite databases.
http://greenrobot.org/greendao/
12.63k stars 2.89k forks source link

why? #992

Open androiddk1 opened 5 years ago

androiddk1 commented 5 years ago

Caused by: android.database.sqlite.SQLiteException: table MODEL_INFO_ENTITY has no column named _id (Sqlite code 1 SQLITE_ERROR): , while compiling: INSERT INTO "MODEL_INFO_ENTITY" ("_id","MACHINE_ID","NAME","TYPE","IS_SELECT","IMG_URL","COUNT","DATE","CHILDREN_LIST") VALUES (?,?,?,?,?,?,?,?,?), (OS error - 2:No such file or directory) at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:948) at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:559) at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:603) at android.database.sqlite.SQLiteProgram.(SQLiteProgram.java:63) at android.database.sqlite.SQLiteStatement.(SQLiteStatement.java:31) at android.database.sqlite.SQLiteDatabase.compileStatement(SQLiteDatabase.java:1166) at org.greenrobot.greendao.database.StandardDatabase.compileStatement(StandardDatabase.java:67) at org.greenrobot.greendao.internal.TableStatements.getInsertStatement(TableStatements.java:52) at org.greenrobot.greendao.AbstractDao.insertInTx(AbstractDao.java:236) at org.greenrobot.greendao.AbstractDao.insertInTx(AbstractDao.java:215)

image

greenrobot-team commented 5 years ago

The stack trace includes OS error - 2:No such file or directory. Was the database file maybe deleted in the meantime?

Also, if you are using SQLcipher https://github.com/greenrobot/greenDAO/issues/634 may have a solution.