Bug 277 : Rien patch for updatable=false ... with DeleteHandler and ImportedIdSimple
Priority 
High
Reported Version 
 
Logged By 
Rob
Status 
Fixed
Fixed Version 
2.6.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
14/04/2010
Updated 
14/04/2010
Type 
Bug
 
Attachments 
No attachments

Index: src/main/java/com/avaje/ebeaninternal/server/persist/dml/DeleteHandler.java
===================================================================
--- src/main/java/com/avaje/ebeaninternal/server/persist/dml/DeleteHandler.java (revision 949)
+++ src/main/java/com/avaje/ebeaninternal/server/persist/dml/DeleteHandler.java (working copy)
@@ -24,6 +24,7 @@

import com.avaje.ebeaninternal.api.SpiTransaction;
import com.avaje.ebeaninternal.server.core.PersistRequestBean;
+import com.avaje.ebeaninternal.server.deploy.BeanProperty;
import com.avaje.ebeaninternal.server.type.DataBind;

/**
@@ -80,4 +81,16 @@
persistRequest.postExecute();
return rowCount;
}
+
+
+
+ @Override
+ public boolean isIncluded(BeanProperty prop) {
+
+ return prop.isDbUpdatable() && super.isIncluded(prop);
+ }
+
+ public boolean hasChangedColumns() {
+ return true;
+ }
}
Index: src/main/java/com/avaje/ebeaninternal/server/deploy/id/ImportedIdSimple.java
===================================================================
--- src/main/java/com/avaje/ebeaninternal/server/deploy/id/ImportedIdSimple.java (revision 949)
+++ src/main/java/com/avaje/ebeaninternal/server/deploy/id/ImportedIdSimple.java (working copy)
@@ -110,15 +110,17 @@

public void dmlWhere(GenerateDmlRequest request, Object bean){

- Object value = null;
- if (bean != null){
- value = getIdValue(bean);
- }
- if (value == null){
- request.appendColumnIsNull(localDbColumn);
- } else {
- request.appendColumn(localDbColumn);
- }
+ if (this.owner.isDbUpdatable()) {
+ Object value = null;
+ if (bean != null) {
+ value = getIdValue(bean);
+ }
+ if (value == null) {
+ request.appendColumnIsNull(localDbColumn);
+ } else {
+ request.appendColumn(localDbColumn);
+ }
+ }
}

public boolean hasChanged(Object bean, Object oldValues) {

 
Rob 14 Apr 11:40
Effectively

Effectively this patch is adding additional prop.isDbUpdatable() checks.

Rob 14 Apr 11:41
I'm happy ...

I'm happy with these changes so applying the patch.

woResponse

Upload a file