@@ -1571,47 +1571,6 @@ static void queryWithQueryOptions(DatabaseClient dbClient) {
1571
1571
}
1572
1572
// [END spanner_query_with_query_options]
1573
1573
1574
- // [START spanner_isolation_level_settings]
1575
- static void isolationLevelSetting (DatabaseId db ) {
1576
- // The isolation level specified at the client-level will be applied to all
1577
- // RW transactions.
1578
- DefaultReadWriteTransactionOptions transactionOptions =
1579
- DefaultReadWriteTransactionOptions .newBuilder ()
1580
- .setIsolationLevel (IsolationLevel .SERIALIZABLE )
1581
- .build ();
1582
- SpannerOptions options =
1583
- SpannerOptions .newBuilder ()
1584
- .setDefaultTransactionOptions (transactionOptions )
1585
- .build ();
1586
- Spanner spanner = options .getService ();
1587
- DatabaseClient dbClient = spanner .getDatabaseClient (db );
1588
- dbClient
1589
- // The isolation level specified at the transaction-level takes precedence
1590
- // over the isolation level configured at the client-level.
1591
- .readWriteTransaction (Options .isolationLevel (IsolationLevel .REPEATABLE_READ ))
1592
- .run (transaction -> {
1593
- // Read an AlbumTitle.
1594
- String select_sql =
1595
- "SELECT AlbumTitle from Albums WHERE SingerId = 1 and AlbumId = 1" ;
1596
- ResultSet resultSet = transaction .executeQuery (Statement .of (select_sql ));
1597
- String title = null ;
1598
- while (resultSet .next ()) {
1599
- title = resultSet .getString ("AlbumTitle" );
1600
- }
1601
- System .out .printf ("Current album title: %s\n " , title );
1602
-
1603
- // Update the title.
1604
- String update_sql =
1605
- "UPDATE Albums "
1606
- + "SET AlbumTitle = 'New Album Title' "
1607
- + "WHERE SingerId = 1 and AlbumId = 1" ;
1608
- long rowCount = transaction .executeUpdate (Statement .of (update_sql ));
1609
- System .out .printf ("%d record updated.\n " , rowCount );
1610
- return null ;
1611
- });
1612
- }
1613
- // [END spanner_isolation_level_settings]
1614
-
1615
1574
// [START spanner_create_backup]
1616
1575
static void createBackup (DatabaseAdminClient dbAdminClient , DatabaseId databaseId ,
1617
1576
BackupId backupId , Timestamp versionTime ) {
@@ -2116,9 +2075,6 @@ static void run(
2116
2075
case "querywithqueryoptions" :
2117
2076
queryWithQueryOptions (dbClient );
2118
2077
break ;
2119
- case "isolationlevelsettings" :
2120
- isolationLevelSetting (database );
2121
- break ;
2122
2078
case "createbackup" :
2123
2079
createBackup (dbAdminClient , database , backup , getVersionTime (dbClient ));
2124
2080
break ;
@@ -2223,7 +2179,6 @@ static void printUsageAndExit() {
2223
2179
System .err .println (" SpannerExample querywithtimestampparameter my-instance example-db" );
2224
2180
System .err .println (" SpannerExample clientwithqueryoptions my-instance example-db" );
2225
2181
System .err .println (" SpannerExample querywithqueryoptions my-instance example-db" );
2226
- System .err .println (" SpannerExample isolationlevelsettings my-instance example-db" );
2227
2182
System .err .println (" SpannerExample createbackup my-instance example-db" );
2228
2183
System .err .println (" SpannerExample listbackups my-instance example-db" );
2229
2184
System .err .println (" SpannerExample listbackupoperations my-instance example-db backup-id" );
0 commit comments