android - java.lang.IllegalStateException: get field slot from row 0 col 25 failed -
i trying create android app using greendao, erp kind of project practically not possible post code here, going share related code
querybuilder<partycommunication> partycommquerybuilder = partycommunicationdao.querybuilder(); partycommquerybuilder = partycommquerybuilder.where( partycommunicationdao.properties.commtype.eq("alert"), partycommunicationdao.properties.referencecategory.eq("low stock")); list<partycommunication> listofpartycomm = partycommquerybuilder.list(); partycommunication daopartycommunication = listitr.next(); long reference_entity_key = daopartycommunication.getreferenceentitykey(); product product = daosessionuni.getproductdao().load(reference_entity_key); productdetail productdetail = new productdetail(product); integer inventoryqoh= productdetail.getinventoryqoh();
i getting exception in line
product product = daosessionuni.getproductdao().load(reference_entity_key);
when debug our application found throwing exception 1 of our dao class below
public product readentity(cursor cursor, int offset) { product entity = new product( // . . . . cursor.getshort(offset + 23) != 0, // issync cursor.getshort(offset + 24) != 0, // isdeleted cursor.getstring(offset + 25), // createdby cursor.getstring(offset + 26), // modifiedby cursor.isnull(offset + 27) ? null : new java.util.date(cursor.getlong(offset + 27)), // lastsynctime new java.util.date(cursor.getlong(offset + 28)), // created new java.util.date(cursor.getlong(offset + 29)) // modified ); return entity; }
in line
cursor.getstring(offset + 25), // createdby
this our 25th column of table.i know code not enough understand going wrong , why getting exception , going post logcat output
java.lang.illegalstateexception: field slot row 0 col 25 failed @ net.sqlcipher.cursorwindow.getstring_native(native method) @ net.sqlcipher.cursorwindow.getstring(cursorwindow.java:382) @ net.sqlcipher.abstractwindowedcursor.getstring(abstractwindowedcursor.java:51) @ android.database.cursorwrapper.getstring(cursorwrapper.java:114) @ com.tarnea.kareeb.model.productdao.readentity(productdao.java:273) @ com.tarnea.kareeb.model.productdao.readentity(productdao.java:1) @ de.greenrobot.dao.abstractdao.loadcurrent(abstractdao.java:417) @ de.greenrobot.dao.abstractdao.loadunique(abstractdao.java:163) @ de.greenrobot.dao.abstractdao.loaduniqueandclosecursor(abstractdao.java:150) @ de.greenrobot.dao.abstractdao.load(abstractdao.java:139) @ com.tarnea.android.datacleaningservice.adjustlowstockalerttable(datacleaningservice.java:115) @ com.tarnea.sync.kareeb.pharma.syncadapter.syncmanager.performsync(syncmanager.java:970) @ com.tarnea.sync.kareeb.pharma.syncadapter.syncadapter.onperformsync(syncadapter.java:96) @ android.content.abstractthreadedsyncadapter$syncthread.run(abstractthreadedsyncadapter.java:254
thanks in advance all.if have interest solve problem please please ask further information whatever want.
your problem isn't query. sqlite-table contain 24 columns.
probably modified database schema adding new columns createdby
.
- either forgot update db using
openhelper
- or had error in
alter table
-statements - or ran app new schema-version without
alter table
-statements yet included (which practically same 1.
have @ database using sqlitemanager, verify tables have columns expect.
if cannot database-file can delete app data or increase schema-version , use devopenhelper
recreate whole database.
Comments
Post a Comment