{"action":"created","issue":{"url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/issues/524","labels_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/issues/524/labels{/name}","comments_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/issues/524/comments","events_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/issues/524/events","html_url":"https://github.com/couchbase/couchbase-lite-java-core/issues/524","id":64477429,"number":524,"title":"onChangeListener called earlier than the completion of the transaction","user":{"login":"QRPro","id":10216417,"avatar_url":"https://avatars.githubusercontent.com/u/10216417?v=3","gravatar_id":"","url":"https://api.github.com/users/QRPro","html_url":"https://github.com/QRPro","followers_url":"https://api.github.com/users/QRPro/followers","following_url":"https://api.github.com/users/QRPro/following{/other_user}","gists_url":"https://api.github.com/users/QRPro/gists{/gist_id}","starred_url":"https://api.github.com/users/QRPro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/QRPro/subscriptions","organizations_url":"https://api.github.com/users/QRPro/orgs","repos_url":"https://api.github.com/users/QRPro/repos","events_url":"https://api.github.com/users/QRPro/events{/privacy}","received_events_url":"https://api.github.com/users/QRPro/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-03-26T09:12:13Z","updated_at":"2015-03-27T05:07:06Z","closed_at":"2015-03-27T04:51:15Z","body":"getDatabase().beginTransaction();\r\n......\r\ndocument.putProperties(map);......\r\n\r\n-> onChangeListener -> Document changed\r\n\r\n..... sleep\r\ngetDatabase().endTransaction(true);\r\n\r\nIt's normal work? If I do not want to confirm the transaction and will do getDatabase().endTransaction(false); I also got an event((("},"comment":{"url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/issues/comments/86826616","html_url":"https://github.com/couchbase/couchbase-lite-java-core/issues/524#issuecomment-86826616","issue_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/issues/524","id":86826616,"user":{"login":"QRPro","id":10216417,"avatar_url":"https://avatars.githubusercontent.com/u/10216417?v=3","gravatar_id":"","url":"https://api.github.com/users/QRPro","html_url":"https://github.com/QRPro","followers_url":"https://api.github.com/users/QRPro/followers","following_url":"https://api.github.com/users/QRPro/following{/other_user}","gists_url":"https://api.github.com/users/QRPro/gists{/gist_id}","starred_url":"https://api.github.com/users/QRPro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/QRPro/subscriptions","organizations_url":"https://api.github.com/users/QRPro/orgs","repos_url":"https://api.github.com/users/QRPro/repos","events_url":"https://api.github.com/users/QRPro/events{/privacy}","received_events_url":"https://api.github.com/users/QRPro/received_events","type":"User","site_admin":false},"created_at":"2015-03-27T05:07:06Z","updated_at":"2015-03-27T05:07:06Z","body":"We use beginTransaction() and getDatabase().endTransaction(); to roll back the transaction if we have a problem. document.putProperties not always succeeds!\r\n\r\nExample:\r\n\r\n\r\ngetDatabase().beginTransaction();\r\n......\r\nBoolean r1 = document.putProperties(map);\r\nBoolean r2 = document.putProperties(map2);\r\n\r\nif (r1 && r2)\r\n  getDatabase().endTransaction(true);\r\nelse {\r\n  getDatabase().endTransaction(flase);\r\n  ShowReport(\"Error: try again\");\r\n}\r\n"}}