私のAndroidアプリでORMLiteを使用しています。HashMapを持つこのクラスを永続化する必要があります。それを持続させる良い方法は何ですか?HashMapを永続化するのは初めてで、ORMLiteを初めて使用するので、アドバイスをいただければ幸いです。
*編集* それが何か違いを生む場合、Exerciseクラスは単純にString(データベースではidとしても機能します)であり、Setクラスにはint id(データベースではidでもあります)、int weight、intrepsがあります。
@DatabaseTable
public class Workout {
@DatabaseField(generatedId = true)
int id;
@DatabaseField(canBeNull = false)
Date created;
/*
* The hashmap needs to be persisted somehow
*/
HashMap<Exercise, ArrayList<Set>> workoutMap;
public Workout() {
}
public Workout(HashMap<Exercise, ArrayList<Set>> workoutMap, Date created){
this.workoutMap = workoutMap;
this.created = created;
}
public void addExercise(Exercise e, ArrayList<Set> setList) {
workoutMap.put(e, setList);
}
...
}