I have a Client bean ,
@DatabaseField(columnName = \"client_id\",generatedId = true,useGetSet = true)
private Integer clientId;
@DatabaseField(columnName = \"cli
To implement cascading while using ORMLite on Android you need to enable foreign key restraints as described here:
(API level > 16)
@Override
public void onOpen(SQLiteDatabase db){
super.onOpen(db);
if (!db.isReadOnly()){
db.setForeignKeyConstraintsEnabled(true);
}
}
For API level < 16 please read: Foreign key constraints in Android using SQLite? on Delete cascade
Then use columnDefinition annotation to define cascading deletes. Ex:
@DatabaseField(foreign = true,
columnDefinition = "integer references my_table(id) on delete cascade")
private MyTable table;
This is assuming the table/object name is "my_table", as described here: Creating foreign key constraints in ORMLite under SQLite