use of org.springframework.cloud.gcp.data.spanner.core.SpannerReadOptions in project spring-cloud-gcp by spring-cloud.
the class SpannerTemplateIntegrationTests method readOnlyTransactionTest.
@Test
public void readOnlyTransactionTest() {
this.expectedEx.expect(SpannerDataException.class);
this.expectedEx.expectMessage("A read-only transaction template cannot perform mutations.");
Trade trade = Trade.aTrade();
this.spannerOperations.performReadOnlyTransaction((transactionOperations) -> {
// cannot do mutate in a read-only transaction
transactionOperations.insert(trade);
return null;
}, new SpannerReadOptions());
}
Aggregations