I am trying to translate some of the code of Objective C in Java…
[_db beginTransaction];
Date now = [[NSDate alloc] init];
boolean result = [_db executeUpdate:updateQuery, [self stringToDB:account.userId],
[self integerToDB:account.accountId],
[self integerToDB:account.accountType],
[self stringToDB:account.accountName],
];
[_db commit];
return true;
Can anyone tell me how can i implement BeginTransaction and Commit in Java?
Since you tagged this ‘Android’, the Android SDK has a SQLiteDatabase class that’s typically wrapped by a helper class (if you follow the guides/tuts/etc. out there).
SQLiteDatabase has
beginTransaction()andendTransaction()that let you run… erm, database transactions.endTransaction()is sort of like a commit but with caveats. Refer to the documentation for more info.