I'm trying to map my classes to the SQLite database using ORMLite and i have trouble to store a collection of String i have this error :
java.lang.IllegalArgumentException: No fields have a DatabaseField annotation in
class java.lang.String
this error is self explanatory but how i do to store a collection of strings should i extend String class and add the annotations needed in order to do that ? in the annotation of the field i added datatype.serializable but that too wouldn't work. here's my class where i have the problem :
@DatabaseTable(tableName = "parameters")
public class Parameters {
// id is generated by the database and set on the object automagically
@DatabaseField(generatedId = true)
int id_parameters;
@DatabaseField(canBeNull = true)
@JsonProperty("id")
private Integer id;
@DatabaseField(canBeNull = false)
@JsonProperty("account_id")
private Integer account_id;
@ForeignCollectionField
@JsonProperty("languages")
private Collection<String> languages;
...
}
the field in question is languages!
Yeah, you can't just do a collection of strings. You will need to create a wrapper class with a
String
field in it as well as a foreignParameters
field:Here's the description of foreign collections from the FM. To quote: