0
如何在Ormlite中實現一對一的關係?假設我有實體國家和資本。ormlite與一對一的關係
@DatabaseTable(tableName = "countries")
public class Country {
@DatabaseField(generatedId = true)
int id;
@DatabaseField
String name;
public Country() {
}
}
@DatabaseTable(tableName = "capitals")
public class Capital {
@DatabaseField(generatedId = true)
int id;
@DatabaseField
String name;
public Capital() {
}
}
這是真的,我必須國家類這個領域?
@DatabaseField(foreign = true)
Capital capital;
...在資本類這個領域?
@DatabaseField
Country country;