-2

I want to perform units of work in a single transaction using Google spanner template,

spannerTemplate.performReadWriteTransaction(trasac -> {
  // Write in table 1
  // Write in table 2   
});

Am getting exception as 'Nested transactions are not supported', please help me on this.

wild
  • 141
  • 1
  • 3
  • 17

2 Answers2

1

Maybe this could help: I had @Transactional annotations on service methods that called performReadWriteTransaction method, so I removed that annotation. As stated here such methods "cannot be used in @Transactional annotated methods because Cloud Spanner does not support transactions within transactions."

0

As per the change described here nested transactions are blocked by default on Spanner Client libraries.

To override this behavior you can call TransactionRunner.allowNestedTransaction() instead.

Soni Sol
  • 2,037
  • 2
  • 7
  • 20