android – 列为@ForeignCollectionField ormlite
作者:互联网
我有我的模特班
List<String> _photo_array;
因为我可以在String Class上进行anotation,是否可以使用ormLite来保持它?
解决方法:
since I can put anotation on String Class is it a way to persist it using ormLite?
您将不得不创建一个包装String的实体.就像是:
@DatabaseTable
public class Photo {
@DatabaseField(generatedId = true)
private int id;
@DatabaseField
private String photo;
@DatabaseField(foreign = true)
private Model model;
}
然后你的模型类会有这些照片的ForeignCollection.
@DatabaseTable
public class Model {
@DatabaseField(generatedId = true)
private int id;
@ForeignCollectionField()
private ForeignCollection<Photo> photos;
}
标签:android,ormlite 来源: https://codeday.me/bug/20190725/1532246.html