{"action":"opened","issue":{"url":"https://api.github.com/repos/phenotips/phenotips/issues/1342","labels_url":"https://api.github.com/repos/phenotips/phenotips/issues/1342/labels{/name}","comments_url":"https://api.github.com/repos/phenotips/phenotips/issues/1342/comments","events_url":"https://api.github.com/repos/phenotips/phenotips/issues/1342/events","html_url":"https://github.com/phenotips/phenotips/issues/1342","id":53347631,"number":1342,"title":"org.hibernate.NonUniqueObjectException after clicking 'Cancel' on patient record","user":{"login":"buske","id":4251264,"avatar_url":"https://avatars.githubusercontent.com/u/4251264?v=3","gravatar_id":"","url":"https://api.github.com/users/buske","html_url":"https://github.com/buske","followers_url":"https://api.github.com/users/buske/followers","following_url":"https://api.github.com/users/buske/following{/other_user}","gists_url":"https://api.github.com/users/buske/gists{/gist_id}","starred_url":"https://api.github.com/users/buske/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buske/subscriptions","organizations_url":"https://api.github.com/users/buske/orgs","repos_url":"https://api.github.com/users/buske/repos","events_url":"https://api.github.com/users/buske/events{/privacy}","received_events_url":"https://api.github.com/users/buske/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/phenotips/phenotips/labels/bug","name":"bug","color":"e10c02"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-01-04T20:36:52Z","updated_at":"2015-01-04T20:36:52Z","closed_at":null,"body":"If a record is opened for editing, and then 'Cancel' is clicked, the record should not be edited. However, if the server starts making ontology updating edits to the record, clicking 'Cancel' causes the following error to be displayed (and the system edits to still have been made). If the same record is then re-opened, and the process repeated, no error will occur.\r\n\r\nTo reproduce:\r\n- Start editing an old record (that will be updated by the system on edit)\r\n- Click 'Cancel'\r\n\r\nI've tested this on F0000009 and F0000010, which means another old record should be used for reproducing.\r\n\r\n```\r\nDetailed information:\r\n    Error number 3201 in 3: Exception while saving document xwiki:data.F0000009\r\ncom.xpn.xwiki.XWikiException: Error number 3201 in 3: Exception while saving document xwiki:data.F0000009\r\n\tat com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:779)\r\n\tat com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:177)\r\n\tat com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:170)\r\n\tat com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1305)\r\n\tat com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1249)\r\n\tat com.xpn.xwiki.XWiki.rollback(XWiki.java:6331)\r\n\tat com.xpn.xwiki.web.RollbackAction.action(RollbackAction.java:51)\r\n\tat com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:293)\r\n\tat com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:129)\r\n\tat org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)\r\n\tat org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)\r\n\tat org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)\r\n\tat org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)\r\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:617)\r\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:717)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\r\n\tat com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:121)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\r\n\tat org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\r\n\tat org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:111)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\r\n\tat org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)\r\n\tat org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)\r\n\tat org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)\r\n\tat org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)\r\n\tat org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)\r\n\tat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)\r\n\tat org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)\r\n\tat org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)\r\n\tat org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)\r\n\tat org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)\r\n\tat org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)\r\n\tat org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)\r\n\tat java.lang.Thread.run(Thread.java:745)\r\nCaused by: com.xpn.xwiki.XWikiException: Error number 3211 in 3: Exception while saving object data.F0000009\r\n\tat com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiCollection(XWikiHibernateStore.java:1176)\r\n\tat com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:753)\r\n\t... 38 more\r\nCaused by: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.xpn.xwiki.objects.BaseObject#-3104141496837280302]\r\n\tat org.hibernate.engine.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:638)\r\n\tat org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performUpdate(DefaultSaveOrUpdateEventListener.java:305)\r\n\tat org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsDetached(DefaultSaveOrUpdateEventListener.java:246)\r\n\tat org.hibernate.event.def.DefaultUpdateEventListener.performSaveOrUpdate(DefaultUpdateEventListener.java:57)\r\n\tat org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)\r\n\tat org.hibernate.impl.SessionImpl.fireUpdate(SessionImpl.java:742)\r\n\tat org.hibernate.impl.SessionImpl.update(SessionImpl.java:730)\r\n\tat com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiCollection(XWikiHibernateStore.java:1114)\r\n\t... 39 more\r\n```"}}