ConstraintViolationException: Duplicate entry 'xyz' for key 'cru_user_name' after upgrading to 2.7

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Medium
    • 2.7.4
    • Affects Version/s: 2.7.3
    • Component/s: None
    • None

      After upgrading to FECRU 2.7, the following error occurs:

      org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
              at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96)
              at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
              at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
              at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:114)
              at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:109)
              at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:244)
              at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2395)
              at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2858)
              at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79)
              at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:267)
              at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:259)
              at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:178)
              at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
              at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:64)
              at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1175)
              at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1251)
              at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
              at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:859)
              at com.atlassian.fecru.user.UserDAOImpl.getByUsername(UserDAOImpl.java:89)
              at com.cenqua.fisheye.user.DefaultUserManager$23.doInTransaction(DefaultUserManager.java:1415)
              at com.atlassian.fisheye.spi.impl.DefaultTxTemplate.execute(DefaultTxTemplate.java:123)
              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:597)
              at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
              at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
              at com.cenqua.crucible.hibernate.WithSessionAspect.doCloseSession(WithSessionAspect.java:37)
              at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
              at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
              at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
              at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
              at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
              at $Proxy19.execute(Unknown Source)
              at com.cenqua.fisheye.user.DefaultUserManager.setCrucibleEnabled(DefaultUserManager.java:1413)
              at com.cenqua.fisheye.user.DefaultUserManager$18.write(DefaultUserManager.java:1152)
              at com.cenqua.fisheye.user.DefaultUserManager$18.write(DefaultUserManager.java:1110)
              at com.cenqua.fisheye.config.DB0Handle.write(DB0Handle.java:96)
              at com.cenqua.fisheye.user.DefaultUserManager.addUserImpl(DefaultUserManager.java:1110)
              at com.cenqua.fisheye.user.DefaultUserManager.importUser(DefaultUserManager.java:554)
              at com.cenqua.fisheye.user.DefaultUserManager.getOrImportUser(DefaultUserManager.java:534)
      

      As a result of this error, some users cannot log in anymore. In other cases, a user cannot be created.

      The problem is that in 2.7, no new user with the same name as a previously deleted user can be created. This applies not only to new users, but also to users that are automatically imported from Crowd or LDAP.

            Assignee:
            Michael Heemskerk (Inactive)
            Reporter:
            Michael Heemskerk (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - Not Specified
                Not Specified
                Logged:
                Time Spent - 5m
                5m