summaryrefslogtreecommitdiff
path: root/src/main/java/com/amazon/carbonado/gen
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2007-09-03 17:13:02 +0000
committerBrian S. O'Neill <bronee@gmail.com>2007-09-03 17:13:02 +0000
commitce4fecd9d313d61d9468954c675e735d468a4a5e (patch)
tree443126fa9931526230817a8e2c9448e556099cab /src/main/java/com/amazon/carbonado/gen
parent4db278970eec5165c04fa0bc1d9c2dd7aa7ce6b3 (diff)
Calling Storable.update when there are no dirty properties actually does an update instead of being "smart" and ignoring the update request. The old behavior was non-intuitive and interfered with expected trigger behavior.
Diffstat (limited to 'src/main/java/com/amazon/carbonado/gen')
-rw-r--r--src/main/java/com/amazon/carbonado/gen/StorableGenerator.java46
1 files changed, 0 insertions, 46 deletions
diff --git a/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java b/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java
index ea61306..6a66528 100644
--- a/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java
+++ b/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java
@@ -1314,52 +1314,6 @@ public final class StorableGenerator<S extends Storable> {
Label tryStart = addGetTriggerAndEnterTxn
(b, UPDATE_OP, forTryVar, false, triggerVar, txnVar, stateVar);
- // If no properties are dirty, then don't update.
- Label doUpdate = b.createLabel();
- branchIfDirty(b, true, doUpdate);
-
- // Even though there was no update, still need tryLoad side-effect.
- {
- // if (txn != null) {
- // txn.exit();
- // }
- b.loadLocal(txnVar);
- Label noTxn = b.createLabel();
- b.ifNullBranch(noTxn, true);
- b.loadLocal(txnVar);
- b.invokeInterface(transactionType, EXIT_METHOD_NAME, null, null);
- noTxn.setLocation();
-
- Label tryStart2 = b.createLabel().setLocation();
- b.loadThis();
- b.invokeVirtual(DO_TRY_LOAD_METHOD_NAME, TypeDesc.BOOLEAN, null);
-
- Label notUpdated = b.createLabel();
- b.ifZeroComparisonBranch(notUpdated, "==");
-
- // Only mark properties clean if doTryLoad returned true.
- b.loadThis();
- b.invokeVirtual(MARK_ALL_PROPERTIES_CLEAN, null, null);
- b.loadConstant(true);
- b.returnValue(TypeDesc.BOOLEAN);
-
- notUpdated.setLocation();
-
- // Mark properties dirty, to be consistent with a delete side-effect.
- b.loadThis();
- b.invokeVirtual(MARK_PROPERTIES_DIRTY, null, null);
- b.loadConstant(false);
- b.returnValue(TypeDesc.BOOLEAN);
-
- Label tryEnd = b.createLabel().setLocation();
- b.exceptionHandler(tryStart2, tryEnd, FetchException.class.getName());
- b.invokeVirtual(FetchException.class.getName(), "toPersistException",
- TypeDesc.forClass(PersistException.class), null);
- b.throwObject();
- }
-
- doUpdate.setLocation();
-
// Call doTryUpdate.
b.loadThis();
b.invokeVirtual(DO_TRY_UPDATE_METHOD_NAME, TypeDesc.BOOLEAN, null);