{"action":"created","issue":{"url":"https://api.github.com/repos/j256/ormlite-android/issues/34","labels_url":"https://api.github.com/repos/j256/ormlite-android/issues/34/labels{/name}","comments_url":"https://api.github.com/repos/j256/ormlite-android/issues/34/comments","events_url":"https://api.github.com/repos/j256/ormlite-android/issues/34/events","html_url":"https://github.com/j256/ormlite-android/issues/34","id":48106592,"number":34,"title":"cannot rollback - no transaction is active (code 1) in RuntimeExceptionDao#callBatchTasks","user":{"login":"koral--","id":3340954,"avatar_url":"https://avatars.githubusercontent.com/u/3340954?v=3","gravatar_id":"","url":"https://api.github.com/users/koral--","html_url":"https://github.com/koral--","followers_url":"https://api.github.com/users/koral--/followers","following_url":"https://api.github.com/users/koral--/following{/other_user}","gists_url":"https://api.github.com/users/koral--/gists{/gist_id}","starred_url":"https://api.github.com/users/koral--/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koral--/subscriptions","organizations_url":"https://api.github.com/users/koral--/orgs","repos_url":"https://api.github.com/users/koral--/repos","events_url":"https://api.github.com/users/koral--/events{/privacy}","received_events_url":"https://api.github.com/users/koral--/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2014-11-07T17:16:40Z","updated_at":"2015-03-02T13:49:00Z","closed_at":"2015-02-16T22:36:10Z","body":"The following exception has been encountered:\r\n```java\r\nandroid.database.sqlite.SQLiteException: cannot rollback - no transaction is active (code 1)\r\n\tat android.database.sqlite.SQLiteConnection.nativeExecute(Native Method)\r\n\tat android.database.sqlite.SQLiteConnection.execute(SQLiteConnection.java:679)\r\n\tat android.database.sqlite.SQLiteSession.endTransactionUnchecked(SQLiteSession.java:439)\r\n\tat android.database.sqlite.SQLiteSession.endTransaction(SQLiteSession.java:401)\r\n\tat android.database.sqlite.SQLiteDatabase.endTransaction(SQLiteDatabase.java:522)\r\n\tat com.j256.ormlite.android.AndroidDatabaseConnection.setAutoCommit(SourceFile:77)\r\n\tat com.j256.ormlite.misc.TransactionManager.callInTransaction(SourceFile:197)\r\n\tat com.j256.ormlite.stmt.StatementExecutor.callBatchTasks(SourceFile:553)\r\n\tat com.j256.ormlite.dao.BaseDaoImpl.callBatchTasks(SourceFile:633)\r\n\tat com.j256.ormlite.dao.RuntimeExceptionDao.callBatchTasks(SourceFile:534)\r\n```\r\normlite-android:4.48\r\normlite-core:4.48\r\nAndroid: 4.1.2\r\nOnly DB operations in `Callable` are `createOrUpdate`."},"comment":{"url":"https://api.github.com/repos/j256/ormlite-android/issues/comments/76713976","html_url":"https://github.com/j256/ormlite-android/issues/34#issuecomment-76713976","issue_url":"https://api.github.com/repos/j256/ormlite-android/issues/34","id":76713976,"user":{"login":"koral--","id":3340954,"avatar_url":"https://avatars.githubusercontent.com/u/3340954?v=3","gravatar_id":"","url":"https://api.github.com/users/koral--","html_url":"https://github.com/koral--","followers_url":"https://api.github.com/users/koral--/followers","following_url":"https://api.github.com/users/koral--/following{/other_user}","gists_url":"https://api.github.com/users/koral--/gists{/gist_id}","starred_url":"https://api.github.com/users/koral--/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koral--/subscriptions","organizations_url":"https://api.github.com/users/koral--/orgs","repos_url":"https://api.github.com/users/koral--/repos","events_url":"https://api.github.com/users/koral--/events{/privacy}","received_events_url":"https://api.github.com/users/koral--/received_events","type":"User","site_admin":false},"created_at":"2015-03-02T13:49:00Z","updated_at":"2015-03-02T13:49:00Z","body":"Here it is:\r\n```java\r\n\tfinal Calendar cal = getCalendarWithTimezone();\r\n        final RuntimeExceptionDao<LocalUsage, Integer> localUsageDao = getLocalUsageDao();\r\n\r\n        final long oldestTimestamp = getOldestTimestamp();\r\n        final long baseUsage = getBaseUsage();\r\n        final long bootTimestamp = getBootTimestamp();\r\n\r\n        localUsageDao.callBatchTasks(new Callable<Void>()\r\n        {\r\n            @Override\r\n            public Void call() throws Exception\r\n            {\r\n                while (cal.getTimeInMillis() > oldestTimestamp)\r\n                {\r\n                    long usage = cal.getTimeInMillis() > bootTimestamp ? baseUsage : -1L;\r\n                    localUsageDao.createOrUpdate(new LocalUsage(cal.getTimeInMillis(), usage));\r\n                    cal.add(Calendar.DAY_OF_MONTH, -1);\r\n                }\r\n                return null;\r\n            }\r\n        });\r\n```\r\n`LocalUsage` constructor does nothing except assigning field values.\r\n\r\nI guess that database file could not be saved when commiting transaction due to some I/O failure (as described in your link). Some bug related to file I/O may exist in that particular ROM of SGS2. Maybe it will be possible to reproduce that with messing up with database file when transaction is in progress eg. corrupting it."}}