6
Table statement
@DatabaseTable(tableName = "alarmes")
public class ListenerAlarme {
@DatabaseField(generatedId = true)
public long id;
@DatabaseField(canBeNull = true)
public Date dataAlarme;
@DatabaseField(canBeNull = true)
public boolean notificado;
@DatabaseField(foreign = true, canBeNull = false, columnName = "id_item")
public ListenerItem item;
public ListenerAlarme(){
}
}
Consultation
List<ListenerAlarme> alarmeList = mAlarmeDao.queryBuilder().where().eq("id_item", mItem).query();
Error
07-27 16:06:12.304 14544-14544/makerapp.android.minhastarefas E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{makerapp.android.minhastarefas/makerapp.android.minhastarefas.ItemActivity}: java.lang.RuntimeException: java.sql.SQLException: Problems executing Android query: SELECT * FROM `alarmes` WHERE `id_item` = 1
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2146)
at android.app.ActivityThread.access$700(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1238)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:177)
at android.app.ActivityThread.main(ActivityThread.java:4947)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)
I’m trying to see if there’s an item with the id
that I have saved in the table alarmes
and generates this error.
The table
alarmes
has no column calledid_item
.– ramaral
I think you have
id_item
yes:@DatabaseField(foreign = true, canBeNull = false, columnName = "id_item")
– danguilherme
Paste your create table in the question please.
– Jean Carlos
columnName = "id_item" arrow the column name, it calls id_item
– Ilgner de Oliveira