I have this simplified scenario where the second commitChanges fails with an 
optimistic exception:

        s = CayenneDao.instance.getByPrimaryKey(StockCurrent.class, 
testStockcurrentId);
        s.setUnits(s.getUnits()+1));
        context.commitChanges();               
        s.setUnits(s.getUnits()+ 7); 
        context.commitChanges();
 I have traced the log and I can see that the version field con s is not 
updated after first commit, that is annoying because it break's the second 
commit. 

So the question is: what is the cayenne contract in relation to optimistic 
locking ? what does it do ? only testing when committing ? does not update 
version field nor refresh it from db when commiting ?
In my db, I have a version field in every table (integer), and a trigger that 
updates it if not done from the app, any way, how can I make this to work ? 


Atte. Juan Manuel Díaz Lara

Reply via email to