The {@code DatastoreService} provides synchronous access to a schema-lessdata storage system. The fundamental unit of data in this system is the {@code Entity}, which has an immutable identity (represented by a {@code Key}) and zero or more mutable properties. {@code Entity}objects can be created, updated, deleted, retrieved by identifier, and queried via a combination of properties.
The {@code DatastoreService} can be used transactionally andsupports the notion of a "current" transaction. A current transaction is established by calling {@link #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 {@link #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 {@code null}) {@link Transaction} to thesemethods or relying on the behavior governed by the {@link ImplicitTransactionManagementPolicy}. If a user explicitly provides a {@link Transaction} it is up to the user to call{@link Transaction#commit()} or {@link Transaction#rollback()} atthe 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 {@link ImplicitTransactionManagementPolicy} are:{@link #delete(Key)}, {@link #delete(Iterable)}, {@link #get(Key)}, {@link #get(Iterable)}, {@link #put(Entity)}, and {@link #put(Iterable)}.
The overload of prepare that takes a {@link Transaction}parameter behaves the same as the overloads of put, get, and delete that take a {@link Transaction} parameter. However, the overloadof prepare that does not take a {@link Transaction} parameter,unlike put, get, and delete, does not use an existing {@link Transaction} if one is already running and does not consultthe {@link ImplicitTransactionManagementPolicy} if one is notalready running.