By adding the bean to the OptimisticLockException one is able to print a better error message to the user.
Untested yet, but easy enough that it should work:
Index: ../ebean/src/com/avaje/ebean/server/core/PersistRequestBean.java===================================================================--- ../ebean/src/com/avaje/ebean/server/core/PersistRequestBean.java (revision 210)+++ ../ebean/src/com/avaje/ebean/server/core/PersistRequestBean.java Wed Apr 08 09:54:00 CEST 2009@@ -117,7 +116,7 @@ public void checkRowCount(int rowCount) throws SQLException { if (rowCount != 1) { String m = Message.msg("persist.conc2", "" + rowCount);- throw new OptimisticLockException(m);+ throw new OptimisticLockException(m, null, getBean()); } }
Yes, simple enough and fixed in HEAD.