Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9146961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:52:21+00:00 2026-06-17T10:52:21+00:00

My application consumes remote REST API and populates local db with greenDao. I have

  • 0

My application consumes remote REST API and populates local db with greenDao. I have a service with AsyncTask class:

@Override
protected Void doInBackground(Void... params) {
    insert100RowsIntheFirstTable();
    insert100RowsIntheSecondTable();
}

Inside each insert-method I have insertOrReplaceInTx, which I use primarily for performance gain.

What I need is to abandon results if any of the methods fails to retrieve data. It’s supposed to be done through the same transaction.

I wonder if it’s right to surround my insert-method calls with mDaoSession.callInTx(callable) while having insertOrReplaceInTx inside the methods. Am I right?

Additionally, how do I abandon transaction in case exception is raised – is it done automatically by means of greenDao ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T10:52:23+00:00Added an answer on June 17, 2026 at 10:52 am

    Yes use callInTx if your code can throw a exception (if not you can also consider runInTx. Android’s SQLite API takes care of those “nested” transactions.

    After all, callInTx is just some lines of convenience if you look at the source code:

    public <V> V callInTx(Callable<V> callable) throws Exception {
        db.beginTransaction();
        try {
            V result = callable.call();
            db.setTransactionSuccessful();
            return result;
        } finally {
            db.endTransaction();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have put together a .net winform application which consumes a wcf service exposed
I have WCF Service and my Android application consumes it. I am doing this
I am currently working on a WCF application that consumes a Rails REST Service.
We have a application which is triggered from browser. This application consumes around 800
I am developing an android application that consumes web service , the service output
I have been working on a BlackBerry application that consumes web services from ColdFusion
I developed an MCF service and I have tested it on my local machine
I have application which consumes XML and based on this creates a GUI. Basically
I'm building an application that consumes models through an api with ActiveResource. I noticed
I've just started building an api and application that consumes from the api using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.