Comments (8)
I will check it out soon. Unfortunately, I have a lot of work to do now.
from reactiveandroid.
Confirmed, It is due to the missing line code setTransactionSuccessful()
beginTransaction()
/* do sql work here */
ReActiveAndroid.getDatabase(ORMAppDatabase.class).getWritableDatabase().setTransactionSuccessful();
endTransaction()
from reactiveandroid.
@bennith Good job! I will add new API for working with transactions in the new version.
from reactiveandroid.
Moved code to pass through AsyncTask to stop UI freezing (worked), however, the below,
begin/end transaction, even though the
if(class.save() > 0){}
passes true on each data item (in List<>), nothing gets actually added or updated (get count of 0)
still persists..
from reactiveandroid.
- Can you create a test project, that reproduces your problem?
- To avoid UI freezing you have to perform your operations with a database in the background thread.
from reactiveandroid.
@bennith can you create a simple project that reproduces your problem, and share it on GitHub?
from reactiveandroid.
Please see sample project which uses transaction to add data (which still fails), but turning off transactions data is added (getting counts of 15K rows)
Change public static boolean useTransactions = true;
in MainApplication to enable/disable transaction
Please see ORMHelpers file and the method public static Boolean setRowData(List<String> getPassedData)
which processes the passed data;
https://github.com/Bennith/ORMTransactionExample
from reactiveandroid.
Maybe it is due to missing the setTransactionSuccessful()
to do the actual commit.
I will test this on my side to confirm.
How you can use database transaction in Android
- If you want to start the transaction there is a method
beginTransaction()
- If you want to commit the transaction there is a method
setTransactionSuccessful()
which will commit the values in the database - If you had start the transaction you need to close the transaction so there is a method
endTransaction()
which will end your database transaction
If so, can we add this to the documentation transactions
from reactiveandroid.
Related Issues (20)
- How to distinct select record HOT 1
- How to sum particular column with example HOT 1
- Sample App - Error with open_folders_edit_screen
- Pass Data and Set All Data
- Pass Comma Deliminated String & IN SQL Query HOT 1
- Please review commits to Forked version of master Branch
- Data integrity crash HOT 1
- How to use multiple where clause using String variable HOT 1
- How to get month wise data from database , please give any example anyone HOT 2
- How to use multiple where clause, i have below error HOT 1
- any ETA on using annotations instead of reflection?
- how to get database path ? i want save .db file
- Using with AndroidX HOT 3
- How to get last record in table ? HOT 2
- How to switch between the `ActiveAndroid ` to `ReActiveAndroid ` ORM? HOT 2
- How to change datatype in Sqlitedatabase(Reactive android) HOT 2
- How to load data from a database in Assets folder HOT 3
- Make sure the Cursor is initialized correctly before accessing data from it.
- Lacking Documentation.
- JCenter is at end of life HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reactiveandroid.