From b807ac8cdc3475b3d6dd6fbaf9f4c3f1f8263d10 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Wed, 31 Dec 2008 20:55:22 +0000 Subject: Revert automatic initial version number if insert fails. --- src/main/java/com/amazon/carbonado/layout/LayoutProperty.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/main/java/com/amazon/carbonado/layout') 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(); } } -- cgit v1.2.3