File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
datastore/src/test/java/com/google/datastore/snippets Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 3636import com .google .cloud .datastore .PathElement ;
3737import com .google .cloud .datastore .ProjectionEntity ;
3838import com .google .cloud .datastore .Query ;
39- import com .google .cloud .datastore .Query .ResultType ;
4039import com .google .cloud .datastore .QueryResults ;
4140import com .google .cloud .datastore .ReadOption ;
4241import com .google .cloud .datastore .StringValue ;
5049import com .google .common .collect .ImmutableMap ;
5150import com .google .common .collect .ImmutableSet ;
5251import com .google .common .collect .Iterators ;
52+ import com .google .datastore .v1 .TransactionOptions ;
53+ import com .google .datastore .v1 .TransactionOptions .ReadOnly ;
5354import java .io .IOException ;
5455import java .util .ArrayList ;
5556import java .util .Calendar ;
@@ -826,7 +827,11 @@ public void testTransactionalSingleEntityGroupReadOnly() {
826827 // [START datastore_transactional_single_entity_group_read_only]
827828 Entity taskList ;
828829 QueryResults <Entity > tasks ;
829- Transaction txn = datastore .newTransaction ();
830+ Transaction txn = datastore .newTransaction (
831+ TransactionOptions .newBuilder ()
832+ .setReadOnly (ReadOnly .newBuilder ().build ())
833+ .build ()
834+ );
830835 try {
831836 taskList = txn .get (taskListKey );
832837 Query <Entity > query = Query .newEntityQueryBuilder ()
You can’t perform that action at this time.
0 commit comments