Android ORMLite find column as an integer type -
in ormlite class database structure want find integer value column name such sql code:
select * my_db my_id = 1; class structure:
public class waybillstructure { @databasefield(generatedid = true) public int id; @databasefield public static int waybill_id; } now want find row in database have 200 code :
int waybill_id = 200; list<waybillstructure> waybilllist = g.waybilldao.querybuilder().where().eq(waybillstructure.waybill_id , waybill_id + "" ).query(); but error :
wrong 1st argument type. found: 'int', required: 'java.lang.string' for waybillstructure.waybill_id section in querybuilder
waybill_id column type int , want find integer in database, how resolve problem in ormlite?
i believe have placed arguments eq() in incorrectly. first argument refers string representation of column name , second argument value wish run equality test against.
the following should solve issue:
g.waybilldao.querybuilder().where().eq("waybill_id", waybill_id).query();
Comments
Post a Comment