DatastoreService (Google App Engine API for Java)

Interface DatastoreService

  • All Superinterfaces:

    public interface DatastoreService
    extends BaseDatastoreService
    The DatastoreService provides synchronous access to a schema-less data storage system. The fundamental unit of data in this system is the Entity, which has an immutable identity (represented by a Key) and zero or more mutable properties. Entity objects can be created, updated, deleted, retrieved by identifier, and queried via a combination of properties.

    The DatastoreService can be used transactionally and supports the notion of a "current" transaction. A current transaction is established by calling beginTransaction(). The transaction returned by this method ceases to be current when an attempt is made to commit or rollback or when another call is made to beginTransaction(). A transaction can only be current within the Thread that created it.

    The various overloads of put, get, and delete all support transactions. Users of this class have the choice of explicitly passing a (potentially null) Transaction to these methods or relying on the behavior governed by the ImplicitTransactionManagementPolicy. If a user explicitly provides a Transaction it is up to the user to call Transaction.commit() or Transaction.rollback() at the proper time. If a user relies on implicit transaction management and the installed policy creates a transaction, that transaction will be committed (in the case of a success) or rolled back (in the case of a failure) before the operation returns to the user. The methods that manage transactions according to ImplicitTransactionManagementPolicy are: delete(Key...), delete(Iterable), get(Key), get(Iterable), put(Entity), and put(Iterable).

    The overload of prepare that takes a Transaction parameter behaves the same as the overloads of put, get, and delete that take a Transaction parameter. However, the overload of prepare that does not take a Transaction parameter, unlike put, get, and delete, does not use an existing Transaction if one is already running and does not consult the ImplicitTransactionManagementPolicy if one is not already running.