Since my application does not use any "long transactions", does the use of automatic versioning make any sense here?
Maybe I would just need to load my persistant object with FOR UPDATE (LockMode.UPGRADE) in my updating methods.
The methods in question look like this:
Code:
public void setName(int catId)
{
Cat cat = Session.load(Cat.class, catId);
cat.setName(...);
}
public void setSex(int catId)
{
Cat cat = Session.load(Cat.class, catId);
cat.setSex(...);
}
The problem I described in the original post was caused by one thread calling setName and the other calling setSex at the same time.
Is it advisable to use LockMode.UPGRADE in these situations?
Would LockMode.UPGRADE have any effect if I continue to use MySQL 4.0 and MyISAM tables?
Regards,
Andreas