Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-9226

NonUniqueObjectException thrown when adding a new page in a plugin

      Argh! have spent several hours on this one... I hope you guys can shed some light on this one...

      Working on a plugin, in a XWork Action. Action is on Page A of Space M

      I am traversing Page A's childrens. getting/setting a few content properties (contentPropertyManager.get/setTextProperty), then create Page B on Space N,This is what I am doing:

      b = new Page();
      b.setTitle(source.getTitle());
      b.setContent(source.getContent());
      b.setSpace(spaceN);
      b.setVersionComment(makePublishingComment(approvalCheck));
      pageManager.saveContentEntity(b,new DefaultSaveContext());
      

      And I get the Exception below... Funny thing is that I don't mess with A's children right before, It works...

      2007-08-20 16:52:10,305 ERROR [http-8082-Processor3] [atlassian.xwork.interceptors.XWorkTransactionInterceptor] onThrowable Invoking 
      rollback for transaction on action '/plugins/approvalsworkflow/save.action (ApprovalsAction.save())' due to throwable: 
      org.springframework.orm.hibernate.HibernateSystemException: a different object with the same identifier value was already associated with
       the session: 17432578, of class: com.atlassian.confluence.spaces.Space; nested exception is net.sf.hibernate.NonUniqueObjectException: a
       different object with the same identifier value was already associated with the session: 17432578, of class:
       com.atlassian.confluence.spaces.Space
      org.springframework.orm.hibernate.HibernateSystemException: a different object with the same identifier value was already associated with
       the session: 17432578, of class: com.atlassian.confluence.spaces.Space; nested exception is net.sf.hibernate.NonUniqueObjectException: a
       different object with the same identifier value was already associated with the session: 17432578, of class:
       com.atlassian.confluence.spaces.Space
      net.sf.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: 
      17432578, of class: com.atlassian.confluence.spaces.Space
              at net.sf.hibernate.impl.SessionImpl.checkUniqueness(SessionImpl.java:1687)
              at net.sf.hibernate.impl.SessionImpl.doUpdateMutable(SessionImpl.java:1453)
              at net.sf.hibernate.impl.SessionImpl.doUpdate(SessionImpl.java:1480)
              at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1403)
              at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114)
              at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436)
              at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503)
              at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:901)
              at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:868)
              at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:790)
              at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:749)
              at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1398)
              at org.springframework.orm.hibernate.HibernateTemplate$16.doInHibernate(HibernateTemplate.java:532)
              at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:312)
              at org.springframework.orm.hibernate.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:529)
              at com.atlassian.hibernate.HibernateObjectDao.saveRaw(HibernateObjectDao.java:148)
              at com.atlassian.confluence.core.DefaultContentEntityManager.saveContentEntity(DefaultContentEntityManager.java:44)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:585)
              at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:284)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:155)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:122)
              at com.atlassian.spring.interceptors.SpringProfilingInterceptor.invoke(SpringProfilingInterceptor.java:20)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
              at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:56)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
              at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174)
              at $Proxy19.saveContentEntity(Unknown Source)
      

      The error is always with that space (id 17432578) that happen to be Space N... Needless to say, I am not modifying Space N at all, just reading it a few statements before adding the page...

      b's id is zero, as it was just created... thing is why is hibernate getting/assinging that existing id!!?!?!!?!?!?!!?!?!?!?!?

            [CONFSERVER-9226] NonUniqueObjectException thrown when adding a new page in a plugin

            Katherine Yabut made changes -
            Workflow Original: JAC Bug Workflow v3 [ 2879362 ] New: CONFSERVER Bug Workflow v4 [ 2987820 ]
            Owen made changes -
            Workflow Original: JAC Bug Workflow v2 [ 2784348 ] New: JAC Bug Workflow v3 [ 2879362 ]
            Status Original: Resolved [ 5 ] New: Closed [ 6 ]
            Owen made changes -
            Workflow Original: JAC Bug Workflow [ 2714636 ] New: JAC Bug Workflow v2 [ 2784348 ]
            Owen made changes -
            Workflow Original: Confluence Workflow - Public Facing - Restricted v5 - TEMP [ 2380524 ] New: JAC Bug Workflow [ 2714636 ]
            Katherine Yabut made changes -
            Workflow Original: Confluence Workflow - Public Facing - Restricted v5 [ 2271826 ] New: Confluence Workflow - Public Facing - Restricted v5 - TEMP [ 2380524 ]
            Katherine Yabut made changes -
            Workflow Original: Confluence Workflow - Public Facing - Restricted v5.1 - TEMP [ 2216516 ] New: Confluence Workflow - Public Facing - Restricted v5 [ 2271826 ]
            Katherine Yabut made changes -
            Workflow Original: Confluence Workflow - Public Facing - Restricted v5 - TEMP [ 2168446 ] New: Confluence Workflow - Public Facing - Restricted v5.1 - TEMP [ 2216516 ]
            Katherine Yabut made changes -
            Workflow Original: Confluence Workflow - Public Facing - Restricted v5 [ 1927649 ] New: Confluence Workflow - Public Facing - Restricted v5 - TEMP [ 2168446 ]
            Katherine Yabut made changes -
            Workflow Original: Confluence Workflow - Public Facing - Restricted v3 [ 1728810 ] New: Confluence Workflow - Public Facing - Restricted v5 [ 1927649 ]
            Katherine Yabut made changes -
            Workflow Original: CONF Bug Subtask WF (TEMP) [ 1686117 ] New: Confluence Workflow - Public Facing - Restricted v3 [ 1728810 ]

              Unassigned Unassigned
              cab5e2ae7e1f Roberto Dominguez
              Affected customers:
              0 This affects my team
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: