Sunday 12 February 2012

JPA: How to know if a OptimisticLockException os thrown

try {
  //access the DAO...
} 
catch(Exception e) {
  if("nested exception is javax.persistence.OptimisticLockException".equals(e.getMessage()))
    //then it is a OptimisticLockException
}

See also...

See how to implement Versioning

No comments:

Post a Comment