如果我有这样的关系,我想要的是每当我在delete()
上致电User
时,vehicle
字段也会被删除。
@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;
}
我认为这可以通过在onDelete = Column.ForeignKeyAction.CASCADE
上使用Vehicle.name
来实现,但我不太确定,所以我会继续问问。