I have the following code from a Andreas Borglin 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 great when I create test objects, but as soon as I want to update them, the boolean values ββdo not change. My saved "isDone" is "true" and I want to change it to "false". What is the conclusion:
model isDone: false savedModel isDone: true model isDone: false
Changing installation strings or 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.
source share