App Engine Java SDK version 1.7.0
[gae.git] / java / src / main / com / google / appengine / api / datastore / ImplicitTransactionManagementPolicy.java
blob927893d4a4b36c3e2c1b96bdaca7da1ee7cac45e
1 // Copyright 2008 Google Inc. All Rights Reserved.
2 package com.google.appengine.api.datastore;
4 import java.util.ConcurrentModificationException;
6 /**
7 * Describes the various policies the datastore can follow for implicit
8 * transaction management. When deciding which policy to use, keep the
9 * following in mind: The datastore will automatically retry operations
10 * that fail due to concurrent updates to the same entity group if the
11 * operation is not part of a transaction. The datastore will not retry
12 * operations that fail due to concurrent updates to the same entity group
13 * if the operation is part of a transaction, and will instead immediately
14 * throw a {@link ConcurrentModificationException}. If your application
15 * needs to perform any sort of intelligent merging when concurrent attempts
16 * are made to update the same entity group you probably want {@link #AUTO},
17 * otherwise {@link #NONE} is probably acceptable.
19 * See {@link DatastoreService} for a list of operations that perform implicit
20 * transaction management.
23 public enum ImplicitTransactionManagementPolicy {
25 /**
26 * If a current transaction exists, use it, otherwise execute without a
27 * transaction.
29 NONE,
31 /**
32 * If a current transaction exists, use it, otherwise create one.
33 * The transaction will be committed before the method returns if the
34 * datastore operation completes successfully and rolled back if the
35 * datastore operation does not complete successfully. No matter the type
36 * or quantity of entities provided, only one transaction will be created.
37 * This means that if you pass entities that belong to multiple entity groups
38 * into one of these methods and you have this policy enabled, you will
39 * receive an exception because transactions do not function across entity
40 * groups.
42 AUTO,