vldpyatkov commented on code in PR #13080:
URL: https://github.com/apache/ignite/pull/13080#discussion_r3160265493


##########
docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/PerformingTransactions.java:
##########
@@ -98,6 +99,36 @@ public static void executingTransactionsExample() {
         }
     }
 
+    public static void transactionSavepointsExample() {
+        try (Ignite ignite = Ignition.start()) {
+            // tag::savepoints[]
+            CacheConfiguration<String, Integer> cfg = new 
CacheConfiguration<>();
+            cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+            cfg.setName("myCache");
+
+            IgniteCache<String, Integer> cache = ignite.getOrCreateCache(cfg);
+
+            try (Transaction tx = 
ignite.transactions().txStart(TransactionConcurrency.PESSIMISTIC,
+                    TransactionIsolation.REPEATABLE_READ)) {
+                cache.put("order:1", 10);
+
+                tx.savepoint("before-shipping");
+
+                cache.put("shipping:1", 5);
+                cache.put("order:1", 15);
+
+                tx.rollbackToSavepoint("before-shipping");
+
+                cache.put("order:1", 11);
+
+                tx.releaseSavepoint("before-shipping");
+
+                tx.commit();
+            }
+            // end::savepoints[]
+        }

Review Comment:
   Added output.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to