-
Notifications
You must be signed in to change notification settings - Fork 308
Closed
Description
Hello everybody. I have a simple entity.
@Entity
public class Teacher {
@Id
public long id;
private String name;
public ToMany<Group> groups;\
}
Having installed app i want to add new value into my entity. Like example it's maybe new functional in future. It's will be look like this.
@Entity
public class Teacher {
@Id
public long id;
private String name;
public ToMany<Group> groups;
private long value;
}
When i installed new variant, my application was crashed.
FATAL EXCEPTION: main
Process: r12.objectboxexample, PID: 28006
java.lang.RuntimeException: Unable to start activity ComponentInfo{r12.objectboxexample/r12.objectboxexample.MainActivity}: java.lang.IllegalArgumentException: Illegal key value: 0
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalArgumentException: Illegal key value: 0
How can i change db(entity) version ? Or maybe how can i delete old enity and recreate with new values ? In sql lite it's look like
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS tableName");
onCreate(db);
}
Sorry, but i didn't find solution in documentation.
Metadata
Metadata
Assignees
Labels
No labels