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

NonUniqueObjectException thrown when adding a new page in a plugin

    XMLWordPrintable

Details

    Description

      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!!?!?!!?!?!?!!?!?!?!?!?

      Attachments

        Activity

          People

            Unassigned Unassigned
            cab5e2ae7e1f Roberto Dominguez
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: