Open ufoscout opened 8 years ago
I wonder if it possible to auto commit a transaction without the need for calling tx.commit(). For example, instead of this:
db.begin() .flatMap(tx -> tx.querySet("insert into products (name) values ($1) returning id", "saw") .map(productsResult -> productsResult.row(0).getLong("id")) .flatMap(id -> tx.querySet("insert into promotions (product_id) values ($1)", id)) .flatMap(promotionsResult -> tx.commit()) ).subscribe( __ -> System.out.println("Transaction committed"), Throwable::printStackTrace);
would it be possible to have this:
boolean autoCommit = true; db.begin(autoCommit) .flatMap(tx -> tx.querySet("insert into products (name) values ($1) returning id", "saw") .map(productsResult -> productsResult.row(0).getLong("id")) .flatMap(id -> tx.querySet("insert into promotions (product_id) values ($1)", id)) ).subscribe( __ -> System.out.println("Transaction committed"), Throwable::printStackTrace);
I wonder if it possible to auto commit a transaction without the need for calling tx.commit(). For example, instead of this:
would it be possible to have this: