← Back to team overview

dhis2-devs team mailing list archive

[Bug 385158] Re: DHIS 1.4 File Import fails when calculated data elements are already present in the database

 

** Changed in: dhis2
    Milestone: None => 2.0.2

-- 
DHIS 1.4 File Import fails when calculated data elements are already present in the database
https://bugs.launchpad.net/bugs/385158
You received this bug notification because you are a member of DHIS 2
developers, which is subscribed to DHIS.

Status in District Health Information Software 2: New

Bug description:
When calculated data elements are already present in the DB, DHIS 1.4 file imports fail if the data elements are already present. I think this is the case, but it is hard to tell. It does not happen on a completely empty database. 

Stack trace below. 
* INFO  12:52:52,687 Imported DataElements (DefaultDhis14FileImportService.java [Thread-27])
* ERROR 12:52:57,656 The process threw exception (ProcessExecutor.java [Thread-27])
java.lang.RuntimeException: Query with RowHandler failed
	at org.hisp.dhis.importexport.dhis14.file.query.IbatisQueryManager.queryWithRowhandler(IbatisQueryManager.java:141)
	at org.hisp.dhis.importexport.dhis14.file.query.IbatisQueryManager.queryWithRowhandler(IbatisQueryManager.java:124)
	at org.hisp.dhis.importexport.dhis14.file.importer.DefaultDhis14FileImportService.importCalculatedDataElements(DefaultDhis14FileImportService.java:346)
	at org.hisp.dhis.importexport.dhis14.file.importer.DefaultDhis14FileImportService.importData(DefaultDhis14FileImportService.java:257)
	at org.hisp.dhis.importexport.ImportInternalProcess.executeStatements(ImportInternalProcess.java:84)
	at org.hisp.dhis.system.process.AbstractStatementInternalProcess.execute(AbstractStatementInternalProcess.java:85)
	at org.hisp.dhis.system.process.AbstractStatementInternalProcess.execute(AbstractStatementInternalProcess.java:37)
	at org.amplecode.cave.process.ProcessExecutor.run(ProcessExecutor.java:126)
	at java.lang.Thread.run(Unknown Source)
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred in sqlmap/calculatedDataElement.sqlmap.xml.  
--- The error occurred while applying a result map.  
--- Check the calculatedDataElement.calculatedDataElementResultMap.  
--- The error happened while setting a property on the result object.  
--- Cause: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [org.hisp.dhis.dataelement.CalculatedDataElement#155]
Caused by: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [org.hisp.dhis.dataelement.CalculatedDataElement#155]
	at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188)
	at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithRowHandler(GeneralStatement.java:133)
	at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryWithRowHandler(SqlMapExecutorDelegate.java:644)
	at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryWithRowHandler(SqlMapSessionImpl.java:121)
	at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryWithRowHandler(SqlMapClientImpl.java:98)
	at org.hisp.dhis.importexport.dhis14.file.query.IbatisQueryManager.queryWithRowhandler(IbatisQueryManager.java:135)
	... 8 more
Caused by: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [org.hisp.dhis.dataelement.CalculatedDataElement#155]
	at org.hibernate.engine.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:590)
	at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performUpdate(DefaultSaveOrUpdateEventListener.java:284)
	at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsDetached(DefaultSaveOrUpdateEventListener.java:223)
	at org.hibernate.event.def.DefaultUpdateEventListener.performSaveOrUpdate(DefaultUpdateEventListener.java:33)
	at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
	at org.hibernate.impl.SessionImpl.fireUpdate(SessionImpl.java:564)
	at org.hibernate.impl.SessionImpl.update(SessionImpl.java:552)
	at org.hibernate.impl.SessionImpl.update(SessionImpl.java:544)
	at org.hisp.dhis.dataelement.hibernate.HibernateDataElementStore.updateDataElement(HibernateDataElementStore.java:79)
	at sun.reflect.GeneratedMethodAccessor317.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
	at org.hisp.dhis.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:75)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	at $Proxy1.updateDataElement(Unknown Source)
	at org.hisp.dhis.dataelement.DefaultDataElementService.updateDataElement(DefaultDataElementService.java:76)
	at sun.reflect.GeneratedMethodAccessor316.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
	at org.hisp.dhis.i18n.interceptor.I18nObjectInterceptor.invoke(I18nObjectInterceptor.java:94)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	at $Proxy2.updateDataElement(Unknown Source)
	at org.hisp.dhis.importexport.converter.AbstractCalculatedDataElementConverter.importMatching(AbstractCalculatedDataElementConverter.java:66)
	at org.hisp.dhis.importexport.converter.AbstractCalculatedDataElementConverter.importMatching(AbstractCalculatedDataElementConverter.java:38)
	at org.hisp.dhis.importexport.converter.AbstractConverter.read(AbstractConverter.java:107)
	at org.hisp.dhis.importexport.dhis14.file.rowhandler.CalculatedDataElementRowHandler.handleRow(CalculatedDataElementRowHandler.java:118)
	at com.ibatis.sqlmap.engine.mapping.statement.RowHandlerCallback.handleResultObject(RowHandlerCallback.java:76)
	at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:395)
	at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:185)
	at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205)
	at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
	... 13 more



References