List<String> as a @ForeignCollectionField ormlite

android, ormlite

Solution

since I can put anotation on String Class is it a way to persist it using ormLite?

You are going to have to create an entity that wraps the `String`. Something like:

 @DatabaseTable
 public class Photo {
     @DatabaseField(generatedId = true)
     private int id;
     @DatabaseField
     private String photo;
     @DatabaseField(foreign = true)
     private Model model;
 }

Then your model class would have a `ForeignCollection` of these photos.

 @DatabaseTable
 public class Model {
     @DatabaseField(generatedId = true)
     private int id;
     @ForeignCollectionField()
     private ForeignCollection<Photo> photos;
 }

See the foreign collection example.

Problem

I have in my model Class ``` List<String> _photo_array; ``` since I can put anotation on String Class is it a way to persist it using ormLite?

Original source

Related problems