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 36
36
import com .google .cloud .datastore .PathElement ;
37
37
import com .google .cloud .datastore .ProjectionEntity ;
38
38
import com .google .cloud .datastore .Query ;
39
- import com .google .cloud .datastore .Query .ResultType ;
40
39
import com .google .cloud .datastore .QueryResults ;
41
40
import com .google .cloud .datastore .ReadOption ;
42
41
import com .google .cloud .datastore .StringValue ;
50
49
import com .google .common .collect .ImmutableMap ;
51
50
import com .google .common .collect .ImmutableSet ;
52
51
import com .google .common .collect .Iterators ;
52
+ import com .google .datastore .v1 .TransactionOptions ;
53
+ import com .google .datastore .v1 .TransactionOptions .ReadOnly ;
53
54
import java .io .IOException ;
54
55
import java .util .ArrayList ;
55
56
import java .util .Calendar ;
@@ -826,7 +827,11 @@ public void testTransactionalSingleEntityGroupReadOnly() {
826
827
// [START datastore_transactional_single_entity_group_read_only]
827
828
Entity taskList ;
828
829
QueryResults <Entity > tasks ;
829
- Transaction txn = datastore .newTransaction ();
830
+ Transaction txn = datastore .newTransaction (
831
+ TransactionOptions .newBuilder ()
832
+ .setReadOnly (ReadOnly .newBuilder ().build ())
833
+ .build ()
834
+ );
830
835
try {
831
836
taskList = txn .get (taskListKey );
832
837
Query <Entity > query = Query .newEntityQueryBuilder ()
You can’t perform that action at this time.
0 commit comments