If I have a relation like this, and what I want is that whenever I call delete()
on an User
, the vehicle
field is also deleted.
@Table (name = "Users")
public class User extends Model {
@Column(name = "Name", unique = true, onUniqueConflict = Column.ConflictAction.REPLACE) name;
@Column(name = "Vehicle") Vehicle vehicle;
}
@Table (name = "Vehicles")
public class Vehicle extends Model {
@Column(name = "Name", unique = true, onUniqueConflict = Column.ConflictAction.REPLACE) name;
}
I think this can be accomplished by using onDelete = Column.ForeignKeyAction.CASCADE
on Vehicle.name
but I'm not so sure so I'll just go ahead and ask.