Enhancement 103 : provide bean with OptimisticLockExcetion
Priority 
High
Reported Version 
 
Logged By 
imario
Status 
Fixed
Fixed Version 
1.2.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
08/04/2009
Updated 
08/04/2009
Type 
Enhancement
 
Attachments 
No attachments

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());
}
}

 
Rob 25 Apr 23:53
Fixed in HEAD

Yes, simple enough and fixed in HEAD.

woResponse

Upload a file