summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2008-05-09 05:16:55 +0000
committerBrian S. O'Neill <bronee@gmail.com>2008-05-09 05:16:55 +0000
commitef26374e59193718c443f3a50f62d52f307a6453 (patch)
tree39ea89b862e3a54fc4f82e54dad1cce11068583c /src/main/java
parent1ef0db0b0b75da108916bb695f9502e356d7375e (diff)
Support derived version property.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableGenerator.java23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableGenerator.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableGenerator.java
index 5207452..993b95c 100644
--- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableGenerator.java
+++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableGenerator.java
@@ -133,6 +133,10 @@ class JDBCStorableGenerator<S extends Storable> {
MasterFeature.INSERT_TXN, // Required because of reload after insert.
MasterFeature.UPDATE_TXN); // Required because of reload after update.
+ if (info.getVersionProperty() != null && info.getVersionProperty().isDerived()) {
+ features.add(MasterFeature.VERSIONING);
+ }
+
if (suppressReload) {
// No need to be in a transaction if reload never happens.
honorSuppression: {
@@ -140,6 +144,9 @@ class JDBCStorableGenerator<S extends Storable> {
info.getIdentityProperties();
for (JDBCStorableProperty<S> prop : mAllProperties.values()) {
+ if (!prop.isSelectable()) {
+ continue;
+ }
if (prop.isAutomatic() && !identityProperties.containsKey(prop.getName())) {
// Might still need to reload. This could be determined
// dynamically, but this is an optimization that be
@@ -865,12 +872,16 @@ class JDBCStorableGenerator<S extends Storable> {
mInfo.getPrimaryKeyProperties().values();
JDBCStorableProperty<S> versionProperty = mInfo.getVersionProperty();
- if (versionProperty != null && versionProperty.isSupported()) {
- // Include version property in WHERE clause to support optimistic locking.
- List<JDBCStorableProperty<S>> list =
- new ArrayList<JDBCStorableProperty<S>>(whereProperties);
- list.add(versionProperty);
- whereProperties = list;
+ if (versionProperty != null) {
+ if (!versionProperty.isSelectable()) {
+ versionProperty = null;
+ } else {
+ // Include version property in WHERE clause to support optimistic locking.
+ List<JDBCStorableProperty<S>> list =
+ new ArrayList<JDBCStorableProperty<S>>(whereProperties);
+ list.add(versionProperty);
+ whereProperties = list;
+ }
}
// If no dirty properties, a valid update statement must still be