Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic Transaction commit #28

Open
ufoscout opened this issue Sep 10, 2016 · 0 comments
Open

Automatic Transaction commit #28

ufoscout opened this issue Sep 10, 2016 · 0 comments
Assignees

Comments

@ufoscout
Copy link

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);
@alaisi alaisi self-assigned this Sep 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants