ORMLIite(Transaction)
We know transaction feature of SQL operations.
ORMLite also have transaction feature.
ORMLite is auto-commit by default.
Transaction
ORMDatabaseHelper dbhelper = new ORMDatabaseHelper(this); final ConnectionSource cs = new AndroidConnectionSource(dbhelper); try { TransactionManager.callInTransaction(cs, new Callable<Void>() { public Void call ( ) throws Exception { // Operations return null; } }); } catch ( Exception oops ) { oops.printStackTrace(); } finally { if ( cs != null ) { try { cs.close(); } catch ( SQLException oops ) { } } }
callInTransaction has features to commit.
If there is failure in call method, rollback all operations automatically.