summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2007-06-11 15:13:11 +0000
committerBrian S. O'Neill <bronee@gmail.com>2007-06-11 15:13:11 +0000
commitbaec3e0467f3aee8e4499c4a9fc701a96b0b7a8b (patch)
tree2d96fa6b2b745c5b293e10439689991411d18bd9 /src
parent7977fcd381e17c4e3bdfebfbf7ca4c0d90cdba1f (diff)
Fix for updating lob property to null.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/amazon/carbonado/gen/StorableGenerator.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java b/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java
index 28dbd9e..bb06708 100644
--- a/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java
+++ b/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java
@@ -942,17 +942,31 @@ public final class StorableGenerator<S extends Storable> {
Label setValue = b.createLabel();
if (!property.isJoin() || Lob.class.isAssignableFrom(property.getType())) {
+ Label markDirty = b.createLabel();
+
if (mGenMode == GEN_ABSTRACT) {
if (Lob.class.isAssignableFrom(property.getType())) {
// Contrary to how standard properties are managed,
- // only mark dirty if value changed.
+ // only mark dirty if value changed. Exception is made
+ // for null -- always mark dirty. This allows LOB property
+ // to be updated to null without having to load it.
+ b.loadLocal(b.getParameter(0));
+ b.ifNullBranch(markDirty, true);
+
b.loadThis();
b.loadField(property.getName(), type);
+ LocalVariable tempProp = b.createLocalVariable(null, type);
+ b.storeLocal(tempProp);
+ b.loadLocal(tempProp);
+ b.ifNullBranch(markDirty, true);
+
+ b.loadLocal(tempProp);
b.loadLocal(b.getParameter(0));
- CodeBuilderUtil.addValuesEqualCall(b, type, true, setValue, true);
+ CodeBuilderUtil.addValuesEqualCall(b, type, false, setValue, true);
}
}
+ markDirty.setLocation();
markOrdinaryPropertyDirty(b, property);
} else {
b.loadLocal(b.getParameter(0));