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 7725255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:53:34+00:00 2026-06-01T04:53:34+00:00

I do not really understand the proper usage pattern of SQLite transactions in Android.

  • 0

I do not really understand the proper usage pattern of SQLite transactions in Android.

Lets say method A starts a transaction. During the execution of the transaction another method B will attempt to do a transaction on the same table (possibly on the same row).

What will happen?

Will the method B “wait” until method A has finished the transaction, and then execute the transaction?
Or will the transction of method B fail?

How do I properly handle that?

To be more precise:

  • Method A should query (inside a transaction) if a certain row already exists, and if so, return the row, if that certain row does not exist yet, it should in insert that row, and return the newly inserted row.
  • Method B should query (inside a transaction) if a certain row already exists, update that row, if the row does not exist yet, Method B should insert that row.

The idea is to make sure, that, no matter which method first executes, to have either have inserted or updated that particular row
I am not even sure, if these can be achieved on the level of SQLite transactions, or do I have to synchronise methods in Java?

If so, can any body post an example, how such a synchronisation has to be coded in Java?

  • 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-01T04:53:35+00:00Added an answer on June 1, 2026 at 4:53 am

    If ‘A’ modifies a table in transaction, ‘B’ should be blocked (inside SQLite itself) until ‘A’ is committed. It’s pretty similar to java synchronization except it’s dealing with persistent data. Some of details depend on isolation levels

    http://en.wikipedia.org/wiki/Isolation_(database_systems)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i've often had this issue where i do not really understand how to pass
I dont really understand why this is not working, I am being returned to
I really do not understand how is this error happening at this code. Please
This should really be allowed - I do not understand why it is not.
Not really a programming question, but relevant to many programmers... Let's say I have
Do not really understand how to ask this question so i added a picture
I am quite new to the embedded linux programming and did not really understand
This is something I am really curious about and I do not really understand
I am reading DataModel-View-ViewModel pattern: 2 I don't really understand the need to check
Not really getting the point of the map function. Can anyone explain with examples

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.