Looks like a legacy issue when OU code was not unique. This is no longer supported, so should be fixed.
** Changed in: dhis2 Status: New => Fix Released -- You received this bug notification because you are a member of DHIS 2 developers, which is subscribed to DHIS. https://bugs.launchpad.net/bugs/1044893 Title: Data import error between 2 DHIS2 systems - Data value Status in DHIS: Fix Released Bug description: When we imported data value exported from DGHS (dhis2 2.7) into dhis2_h1_2_6 (DHIS2 2.7), we found the following error * WARN 10:29:15,795 SQL Error: 1062, SQLState: 23000 (JDBCExceptionReporter.jav a [Thread-16]) * ERROR 10:29:15,796 Duplicate entry 'HS_27451657073' for key 3 (JDBCExceptionRe porter.java [Thread-16]) * ERROR 10:29:15,872 Internal process failed (AbstractStatementInternalProcess.j ava [Thread-16]) org.hibernate.exception.ConstraintViolationException: Could not execute JDBC bat ch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.j ava:96) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelp er.java:66) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java: 275) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:268) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:185) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutio ns(AbstractFlushingEventListener.java:321) at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(Def aultAutoFlushEventListener.java:64) at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1 185) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1709) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347) at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:369) at org.hisp.dhis.hibernate.HibernateGenericStore.getObject(HibernateGene ricStore.java:175) at org.hisp.dhis.hibernate.HibernateGenericStore.getByName(HibernateGene ricStore.java:235) at org.hisp.dhis.organisationunit.DefaultOrganisationUnitService.getOrga nisationUnitByName(DefaultOrganisationUnitService.java:192) at sun.reflect.GeneratedMethodAccessor258.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti on(AopUtils.java:309) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo inpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed( ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.in voke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed( ReflectiveMethodInvocation.java:172) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invok e(ExposeInvocationInterceptor.java:90) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed( ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami cAopProxy.java:202) at $Proxy17.getOrganisationUnitByName(Unknown Source) at org.hisp.dhis.importexport.importer.OrganisationUnitImporter.getMatch ing(OrganisationUnitImporter.java:94) at org.hisp.dhis.importexport.importer.OrganisationUnitImporter.getMatch ing(OrganisationUnitImporter.java:44) at org.hisp.dhis.importexport.importer.AbstractImporter.read(AbstractImp orter.java:84) at org.hisp.dhis.importexport.importer.OrganisationUnitImporter.importOb ject(OrganisationUnitImporter.java:64) at org.hisp.dhis.importexport.dxf.converter.OrganisationUnitConverter.re ad(OrganisationUnitConverter.java:239) at org.hisp.dhis.importexport.invoker.DefaultConverterInvoker.invokeRead (DefaultConverterInvoker.java:45) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti on(AopUtils.java:309) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo inpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed( ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.in voke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed( ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami cAopProxy.java:202) at $Proxy98.invokeRead(Unknown Source) at org.hisp.dhis.importexport.dxf.converter.DXFConverter.read(DXFConvert er.java:733) at org.hisp.dhis.importexport.DefaultImportService.importData(DefaultImp ortService.java:201) at org.hisp.dhis.importexport.ImportInternalProcess.executeStatements(Im portInternalProcess.java:89) at org.hisp.dhis.system.process.AbstractStatementInternalProcess.execute (AbstractStatementInternalProcess.java:103) at org.hisp.dhis.system.process.AbstractStatementInternalProcess.execute (AbstractStatementInternalProcess.java:40) at org.amplecode.cave.process.ProcessExecutor.run(ProcessExecutor.java:1 25) at java.lang.Thread.run(Unknown Source) Caused by: java.sql.BatchUpdateException: Duplicate entry 'HS_27451657073' for k ey 3 at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStateme nt.java:1666) at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java: 1082) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewPr oxyPreparedStatement.java:1723) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.jav a:70) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java: 268) ... 47 more org.hibernate.exception.ConstraintViolationException: Could not execute JDBC bat ch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.j ava:96) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelp er.java:66) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java: 275) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:268) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:185) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutio ns(AbstractFlushingEventListener.java:321) at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(Def aultAutoFlushEventListener.java:64) at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1 185) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1709) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347) at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:369) at org.hisp.dhis.hibernate.HibernateGenericStore.getObject(HibernateGene ricStore.java:175) at org.hisp.dhis.hibernate.HibernateGenericStore.getByName(HibernateGene ricStore.java:235) at org.hisp.dhis.organisationunit.DefaultOrganisationUnitService.getOrga nisationUnitByName(DefaultOrganisationUnitService.java:192) at sun.reflect.GeneratedMethodAccessor258.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti on(AopUtils.java:309) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo inpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed( ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.in voke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed( ReflectiveMethodInvocation.java:172) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invok e(ExposeInvocationInterceptor.java:90) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed( ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami cAopProxy.java:202) at $Proxy17.getOrganisationUnitByName(Unknown Source) at org.hisp.dhis.importexport.importer.OrganisationUnitImporter.getMatch ing(OrganisationUnitImporter.java:94) at org.hisp.dhis.importexport.importer.OrganisationUnitImporter.getMatch ing(OrganisationUnitImporter.java:44) at org.hisp.dhis.importexport.importer.AbstractImporter.read(AbstractImp orter.java:84) at org.hisp.dhis.importexport.importer.OrganisationUnitImporter.importOb ject(OrganisationUnitImporter.java:64) at org.hisp.dhis.importexport.dxf.converter.OrganisationUnitConverter.re ad(OrganisationUnitConverter.java:239) at org.hisp.dhis.importexport.invoker.DefaultConverterInvoker.invokeRead (DefaultConverterInvoker.java:45) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti on(AopUtils.java:309) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo inpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed( ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.in voke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed( ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami cAopProxy.java:202) at $Proxy98.invokeRead(Unknown Source) at org.hisp.dhis.importexport.dxf.converter.DXFConverter.read(DXFConvert er.java:733) at org.hisp.dhis.importexport.DefaultImportService.importData(DefaultImp ortService.java:201) at org.hisp.dhis.importexport.ImportInternalProcess.executeStatements(Im portInternalProcess.java:89) at org.hisp.dhis.system.process.AbstractStatementInternalProcess.execute (AbstractStatementInternalProcess.java:103) at org.hisp.dhis.system.process.AbstractStatementInternalProcess.execute (AbstractStatementInternalProcess.java:40) at org.amplecode.cave.process.ProcessExecutor.run(ProcessExecutor.java:1 25) at java.lang.Thread.run(Unknown Source) Caused by: java.sql.BatchUpdateException: Duplicate entry 'HS_27451657073' for k ey 3 at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStateme nt.java:1666) at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java: 1082) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewPr oxyPreparedStatement.java:1723) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.jav a:70) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java: 268) ... 47 more To manage notifications about this bug go to: https://bugs.launchpad.net/dhis2/+bug/1044893/+subscriptions _______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp