summaryrefslogtreecommitdiff
path: root/src/main/java/com/amazon
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/amazon')
-rw-r--r--src/main/java/com/amazon/carbonado/gen/MasterFeature.java3
-rw-r--r--src/main/java/com/amazon/carbonado/gen/MasterStorableGenerator.java20
2 files changed, 15 insertions, 8 deletions
diff --git a/src/main/java/com/amazon/carbonado/gen/MasterFeature.java b/src/main/java/com/amazon/carbonado/gen/MasterFeature.java
index 8d7211e..90e7751 100644
--- a/src/main/java/com/amazon/carbonado/gen/MasterFeature.java
+++ b/src/main/java/com/amazon/carbonado/gen/MasterFeature.java
@@ -49,6 +49,9 @@ public enum MasterFeature {
*/
INSERT_CHECK_REQUIRED,
+ /** Insert operation never checks if primary key is filled in. */
+ INSERT_NO_CHECK_PRIMARY_PK,
+
/** Ensure insert operation always is in a transaction. */
INSERT_TXN,
diff --git a/src/main/java/com/amazon/carbonado/gen/MasterStorableGenerator.java b/src/main/java/com/amazon/carbonado/gen/MasterStorableGenerator.java
index ef73a2c..791a754 100644
--- a/src/main/java/com/amazon/carbonado/gen/MasterStorableGenerator.java
+++ b/src/main/java/com/amazon/carbonado/gen/MasterStorableGenerator.java
@@ -344,8 +344,9 @@ public final class MasterStorableGenerator<S extends Storable> {
// Add required protected doTryInsert method.
{
if (mFeatures.contains(MasterFeature.PARTITIONING) ||
- mFeatures.contains(MasterFeature.INSERT_SEQUENCES)) {
-
+ mFeatures.contains(MasterFeature.INSERT_SEQUENCES) ||
+ mFeatures.contains(MasterFeature.INSERT_NO_CHECK_PRIMARY_PK))
+ {
MethodInfo mi = mClassFile.addMethod
(Modifiers.PROTECTED,
StorableGenerator.CHECK_PK_FOR_INSERT_METHOD_NAME,
@@ -441,14 +442,17 @@ public final class MasterStorableGenerator<S extends Storable> {
ordinal++;
}
- // We've tried our best to fill in missing values, now run the
- // original check method.
+ // We've tried our best to fill in missing values, so now
+ // run the original check method, if required to.
+ }
+
+ if (!mFeatures.contains(MasterFeature.INSERT_NO_CHECK_PRIMARY_PK)) {
+ b.loadThis();
+ b.invokeSuper(mClassFile.getSuperClassName(),
+ StorableGenerator.CHECK_PK_FOR_INSERT_METHOD_NAME,
+ null, null);
}
- b.loadThis();
- b.invokeSuper(mClassFile.getSuperClassName(),
- StorableGenerator.CHECK_PK_FOR_INSERT_METHOD_NAME,
- null, null);
b.returnVoid();
}