summaryrefslogtreecommitdiff
path: root/src/main/java/com/amazon/carbonado/layout
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2008-12-31 20:55:22 +0000
committerBrian S. O'Neill <bronee@gmail.com>2008-12-31 20:55:22 +0000
commitb807ac8cdc3475b3d6dd6fbaf9f4c3f1f8263d10 (patch)
tree7db774cb06ab149fbee09ee357a22e65118100b3 /src/main/java/com/amazon/carbonado/layout
parentae8c69ffd8c42811c7a4a7e4e8d91c9f94ca506d (diff)
Revert automatic initial version number if insert fails.
Diffstat (limited to 'src/main/java/com/amazon/carbonado/layout')
-rw-r--r--src/main/java/com/amazon/carbonado/layout/LayoutProperty.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/com/amazon/carbonado/layout/LayoutProperty.java b/src/main/java/com/amazon/carbonado/layout/LayoutProperty.java
index a0ce48f..bf35073 100644
--- a/src/main/java/com/amazon/carbonado/layout/LayoutProperty.java
+++ b/src/main/java/com/amazon/carbonado/layout/LayoutProperty.java
@@ -20,6 +20,7 @@ package com.amazon.carbonado.layout;
import org.cojen.classfile.TypeDesc;
+import com.amazon.carbonado.FetchException;
import com.amazon.carbonado.PersistException;
import com.amazon.carbonado.SupportException;
@@ -187,6 +188,13 @@ public class LayoutProperty {
void store() throws PersistException {
if (!mStoredLayoutProperty.tryInsert()) {
+ StoredLayoutProperty existing = mStoredLayoutProperty.copy();
+ try {
+ existing.load();
+ existing.copyVersionProperty(mStoredLayoutProperty);
+ } catch (FetchException e) {
+ throw e.toPersistException();
+ }
mStoredLayoutProperty.update();
}
}