{"action":"opened","issue":{"url":"https://api.github.com/repos/jamesagnew/hapi-fhir/issues/878","repository_url":"https://api.github.com/repos/jamesagnew/hapi-fhir","labels_url":"https://api.github.com/repos/jamesagnew/hapi-fhir/issues/878/labels{/name}","comments_url":"https://api.github.com/repos/jamesagnew/hapi-fhir/issues/878/comments","events_url":"https://api.github.com/repos/jamesagnew/hapi-fhir/issues/878/events","html_url":"https://github.com/jamesagnew/hapi-fhir/issues/878","id":302814369,"number":878,"title":"Resources in a bundle are updated even if their contents don't change","user":{"login":"darktyco","id":18543346,"avatar_url":"https://avatars2.githubusercontent.com/u/18543346?v=4","gravatar_id":"","url":"https://api.github.com/users/darktyco","html_url":"https://github.com/darktyco","followers_url":"https://api.github.com/users/darktyco/followers","following_url":"https://api.github.com/users/darktyco/following{/other_user}","gists_url":"https://api.github.com/users/darktyco/gists{/gist_id}","starred_url":"https://api.github.com/users/darktyco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darktyco/subscriptions","organizations_url":"https://api.github.com/users/darktyco/orgs","repos_url":"https://api.github.com/users/darktyco/repos","events_url":"https://api.github.com/users/darktyco/events{/privacy}","received_events_url":"https://api.github.com/users/darktyco/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-06T18:27:43Z","updated_at":"2018-03-06T18:27:43Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Resources in a bundle are updated even if their contents don't change. Steps to reproduce:\r\n\r\n1) POST a bundle containing a resource:\r\n\r\n```json\r\n{\r\n  \"resourceType\": \"Bundle\",\r\n  \"type\": \"batch\",\r\n  \"entry\": [\r\n    {\r\n      \"resource\": {\r\n        \"resourceType\": \"Patient\",\r\n        \"id\": \"TestBundleUpate\",\r\n        \"name\": [\r\n          {\r\n            \"use\": \"official\",\r\n            \"family\": [\r\n              \"LastName\"\r\n            ]\r\n          }\r\n        ]\r\n      },\r\n      \"request\": {\r\n        \"method\": \"PUT\",\r\n        \"url\": \"Patient/TestBug\"\r\n      }\r\n    }\r\n  ]\r\n}\r\n```\r\n2) POST the bundle a second time without modifying any data.\r\n3) Observe in the response that the etag has incremented.\r\n\r\nThe issue appears to be happening due to the 2-pass technique that the code uses to save batch/transaction bundles (I debugged this in FhirSystemDaoDstu2.java). In the first pass a meta block is being added to the resource which then is saved to the database in the serialized json. Every subsequent update to that resource will have a different meta block causing the code to update the resource each time the bundle is processed."}}
{"actor":{"display_login":"darktyco"}}