I have the following code from Andreas Borglin's tutorial:
@Override
public Model saveModel(Model model) {
System.out.println("model isDone: " + ((Task)model).getDone());
PersistenceManager pm = PMF.get().getPersistenceManager();
Model savedModel = null;
try {
savedModel = pm.makePersistent(model);
} catch (JDOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
pm.close();
}
System.out.println("savedModel isDone: " + ((Task)savedModel).getDone());
System.out.println("model isDone: " + ((Task)model).getDone());
return savedModel;
}
It works fine when I create test entities, but once I want to update them, the boolean values don't change. My saved "isDone" is "true" and I want to change it to "false". That's the output:
model isDone: false
savedModel isDone: true
model isDone: false
Changing strings or setting dates works without a problem. The field is defined as:
@Persistent
private boolean isDone = true;
I also tried:
@Persistent
private Boolean isDone;
In this case, isDone is always "false".