Metadata Import fails due to modifying a program description

Hi Morten,

We have two instances of DHIS. On one instance, we have some sample metadata which is exported and imported into the other instance. On the first instance, we tried to update the program description of a program and import into the other instance. This is throwing an exception during import. Also, the program description at the first instance is cleared after export. Is this a known issue?

Following are the logs generated for the issue:

WARN 2016-03-10 12:02:02,283 SQL Error: 0, SQLState: 23505 (SqlExceptionHelper.java [taskScheduler-6])

  • ERROR 2016-03-10 12:02:02,283 ERROR: duplicate key value violates unique constraint “programtrackedentityattribute_unique_key”

    Detail: Key (programid, trackedentityattributeid)=(801, 708) already exists. (SqlExceptionHelper.java [taskScheduler-6])

org.hibernate.exception.ConstraintViolationException: could not execute statement

at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:129)

at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)

at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124)

at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)

at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:189)

at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:59)

at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3079)

at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3521)

at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:88)

at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:395)

at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:387)

at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:303)

Could you please look into the issue and help fix this?

Thanks

···

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533
ThoughtWorks

The same also applies to the Program description of the Program stages as well. After export, the program descriptions of program as well as program stages get cleared at the first instance and are not imported into the second instance, throwing an exception as mentioned in the previous mail.

···

On Thu, Mar 10, 2016 at 12:27 PM, Archana Chillala archanac@thoughtworks.com wrote:

Hi Morten,

We have two instances of DHIS. On one instance, we have some sample metadata which is exported and imported into the other instance. On the first instance, we tried to update the program description of a program and import into the other instance. This is throwing an exception during import. Also, the program description at the first instance is cleared after export. Is this a known issue?

Following are the logs generated for the issue:

WARN 2016-03-10 12:02:02,283 SQL Error: 0, SQLState: 23505 (SqlExceptionHelper.java [taskScheduler-6])

  • ERROR 2016-03-10 12:02:02,283 ERROR: duplicate key value violates unique constraint “programtrackedentityattribute_unique_key”

Detail: Key (programid, trackedentityattributeid)=(801, 708) already exists. (SqlExceptionHelper.java [taskScheduler-6])

org.hibernate.exception.ConstraintViolationException: could not execute statement

at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:129)
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:189)
at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:59)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3079)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3521)
at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:88)
at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:395)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:387)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:303)

Could you please look into the issue and help fix this?

Thanks

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533
ThoughtWorks

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533
ThoughtWorks

Hi

No, this is not known, I will add it to the list of fixes that is coming to the new importer. Thanks for reporting.

···

On Thu, Mar 10, 2016 at 2:07 PM, Archana Chillala archanac@thoughtworks.com wrote:

The same also applies to the Program description of the Program stages as well. After export, the program descriptions of program as well as program stages get cleared at the first instance and are not imported into the second instance, throwing an exception as mentioned in the previous mail.

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533
ThoughtWorks

On Thu, Mar 10, 2016 at 12:27 PM, Archana Chillala archanac@thoughtworks.com wrote:

Hi Morten,

We have two instances of DHIS. On one instance, we have some sample metadata which is exported and imported into the other instance. On the first instance, we tried to update the program description of a program and import into the other instance. This is throwing an exception during import. Also, the program description at the first instance is cleared after export. Is this a known issue?

Following are the logs generated for the issue:

WARN 2016-03-10 12:02:02,283 SQL Error: 0, SQLState: 23505 (SqlExceptionHelper.java [taskScheduler-6])

  • ERROR 2016-03-10 12:02:02,283 ERROR: duplicate key value violates unique constraint “programtrackedentityattribute_unique_key”

Detail: Key (programid, trackedentityattributeid)=(801, 708) already exists. (SqlExceptionHelper.java [taskScheduler-6])

org.hibernate.exception.ConstraintViolationException: could not execute statement

at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:129)
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:189)
at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:59)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3079)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3521)
at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:88)
at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:395)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:387)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:303)

Could you please look into the issue and help fix this?

Thanks

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533
ThoughtWorks

Morten

Hi

The problem with PTEA has been found, you need to create a new metadata export (PTEA was missing UIDs which messed up the importer). Please try it out (this is now tested for in the new importer, but legacy importer should also still work)

···

On Thu, Mar 10, 2016 at 2:10 PM, Morten Olav Hansen morten@dhis2.org wrote:

Hi

No, this is not known, I will add it to the list of fixes that is coming to the new importer. Thanks for reporting.

On Thu, Mar 10, 2016 at 2:07 PM, Archana Chillala archanac@thoughtworks.com wrote:

The same also applies to the Program description of the Program stages as well. After export, the program descriptions of program as well as program stages get cleared at the first instance and are not imported into the second instance, throwing an exception as mentioned in the previous mail.

Morten

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533
ThoughtWorks

On Thu, Mar 10, 2016 at 12:27 PM, Archana Chillala archanac@thoughtworks.com wrote:

Hi Morten,

We have two instances of DHIS. On one instance, we have some sample metadata which is exported and imported into the other instance. On the first instance, we tried to update the program description of a program and import into the other instance. This is throwing an exception during import. Also, the program description at the first instance is cleared after export. Is this a known issue?

Following are the logs generated for the issue:

WARN 2016-03-10 12:02:02,283 SQL Error: 0, SQLState: 23505 (SqlExceptionHelper.java [taskScheduler-6])

  • ERROR 2016-03-10 12:02:02,283 ERROR: duplicate key value violates unique constraint “programtrackedentityattribute_unique_key”

Detail: Key (programid, trackedentityattributeid)=(801, 708) already exists. (SqlExceptionHelper.java [taskScheduler-6])

org.hibernate.exception.ConstraintViolationException: could not execute statement

at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:129)
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:189)
at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:59)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3079)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3521)
at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:88)
at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:395)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:387)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:303)

Could you please look into the issue and help fix this?

Thanks

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533
ThoughtWorks

Morten