Reputation: 43
Since the update to greenDao 3, statements like those do not work anymore:
getDatabase().insert(TABLENAME, null, values);
getDatabase().delete(...);
getDatabase().update(...);
The getDatabase() is a greenDao interface which doesn't have insert, delete and update methods. Thus, it gives me compile time errors. Anybody solved the issue?
Upvotes: 0
Views: 476
Reputation: 7075
The class you are getting back is org.greenrobot.greendao.database.Database, which is a database abstraction meant only for greenDAO. You have two options:
You hold the reference to the original SQLiteDatabase and pass it to greenDAO during initialization.
The Database abstraction class has a method getRawDatabase, which returns the underlying SQLiteDatabase. If you are not using encryption, it will be always android.database.sqlite.SQLiteDatabase. You have to do a cast.
Upvotes: 1