From baec3e0467f3aee8e4499c4a9fc701a96b0b7a8b Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Mon, 11 Jun 2007 15:13:11 +0000 Subject: Fix for updating lob property to null. --- .../com/amazon/carbonado/gen/StorableGenerator.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/main/java/com/amazon/carbonado/gen') 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 { 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)); -- cgit v1.2.3