← Back to team overview

dhis2-users team mailing list archive

Re: Has metadata import stopped working?

 

Hi!

I was encountering the same error when trying to import metadata with
collection of other objects (parent and child relations) from the web APIs
in version 2.27.
*ERROR:

org.hibernate.TransientObjectException: object references an unsaved
> transient instance - save the transient instance before flushing:
>
I learnt that this happens when hibernate tries to create an object that
references to another object which do not exist in the database. So I tried
posting the metadata objects separately and it worked!

Best regards
==========================
Isaiah Nyabuto
+254729572616
Bsc. Health Records Management and Informatics

On Apr 6, 2018 16:57, "Olav Poppe" <olavpo@xxxxxxxxxx> wrote:

I’m having the same issue and error importing into an empty 2.27 database.
Though in this case a slightly modified dependency export of a tracker
programme, not orgunits.

Knut, did you find a solution?

Sending you the payload, Morten.

Olav


12. jan. 2018 kl. 08:39 skrev Morten Olav Hansen <morten@xxxxxxxxx>:

That sounds weird Knut, would you mind sharing the org unit payload?

-- 
Morten Olav Hansen
Senior Engineer, DHIS 2
University of Oslo
http://www.dhis2.org

On Fri, Jan 12, 2018 at 2:19 AM, Knut Staring <knutst@xxxxxxxxx> wrote:

> I have tried doing metadata export without sharing from 2.27 and importing
> into 2.27, just the OU hierarchy and levels.
>
> Importing into a clean instance gives this:
>
>  INFO  2018-01-11 20:16:06,750 [Level: INFO, category: METADATA_IMPORT,
> time: Thu Jan 11 20:16:06 CET 2018, message: (admin) Creating 8 object(s)
> of type OrganisationUnitLevel] (InMemoryNotifier.java [taskScheduler-4])
> * ERROR 2018-01-11 20:16:07,764 Unexpected error occurred in scheduled
> task. (TaskUtils.java [taskScheduler-4])
> org.hibernate.TransientObjectException: object references an unsaved
> transient instance - save the transient instance before flushing:
> org.hisp.dhis.organisationunit.OrganisationUnit
>         at org.hibernate.engine.internal.ForeignKeys.getEntityIdentifie
> rIfNotUnsaved(ForeignKeys.java:279)
>         at org.hibernate.type.EntityType.getIdentifier(EntityType.java:
> 462)
>         at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:
> 281)
>         at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:
> 291)
>         at org.hibernate.type.TypeHelper.findDirty(TypeHelper.java:322)
>         at org.hibernate.persister.entity.AbstractEntityPersister.findD
> irty(AbstractEntityPersister.java:4204)
>         at org.hibernate.event.internal.DefaultFlushEntityEventListener
> .dirtyCheck(DefaultFlushEntityEventListener.java:528)
>         at org.hibernate.event.internal.DefaultFlushEntityEventListener
> .isUpdateNecessary(DefaultFlushEntityEventListener.java:215)
>         at org.hibernate.event.internal.DefaultFlushEntityEventListener
> .onFlushEntity(DefaultFlushEntityEventListener.java:142)
>         at org.hibernate.event.internal.AbstractFlushingEventListener.f
> lushEntities(AbstractFlushingEventListener.java:216)
>         at org.hibernate.event.internal.AbstractFlushingEventListener.f
> lushEverythingToExecutions(AbstractFlushingEventListener.java:85)
>         at org.hibernate.event.internal.DefaultFlushEventListener.onFlu
> sh(DefaultFlushEventListener.java:38)
>         at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1295)
>         at org.hisp.dhis.dbms.HibernateDbmsManager.clearSession(Hiberna
> teDbmsManager.java:339)
>         at org.hisp.dhis.dxf2.metadata.objectbundle.DefaultObjectBundle
> Service.commit(DefaultObjectBundleService.java:180)
>         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.invokeJoinpointUsin
> gReflection(AopUtils.java:333)
>         at org.springframework.aop.framework.ReflectiveMethodInvocation
> .invokeJoinpoint(ReflectiveMethodInvocation.java:190)
>         at org.springframework.aop.framework.ReflectiveMethodInvocation
> .proceed(ReflectiveMethodInvocation.java:157)
>         at org.springframework.transaction.interceptor.TransactionInter
> ceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
>         at org.springframework.transaction.interceptor.TransactionAspec
> tSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
>         at org.springframework.transaction.interceptor.TransactionInter
> ceptor.invoke(TransactionInterceptor.java:96)
>         at org.springframework.aop.framework.ReflectiveMethodInvocation
> .proceed(ReflectiveMethodInvocation.java:179)
>         at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(
> JdkDynamicAopProxy.java:213)
>         at com.sun.proxy.$Proxy189.commit(Unknown Source)
>         at org.hisp.dhis.dxf2.metadata.DefaultMetadataImportService.imp
> ortMetadata(DefaultMetadataImportService.java:127)
>         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.invokeJoinpointUsin
> gReflection(AopUtils.java:333)
>         at org.springframework.aop.framework.ReflectiveMethodInvocation
> .invokeJoinpoint(ReflectiveMethodInvocation.java:190)
>         at org.springframework.aop.framework.ReflectiveMethodInvocation
> .proceed(ReflectiveMethodInvocation.java:157)
>         at org.springframework.transaction.interceptor.TransactionInter
> ceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
>         at org.springframework.transaction.interceptor.TransactionAspec
> tSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
>         at org.springframework.transaction.interceptor.TransactionInter
> ceptor.invoke(TransactionInterceptor.java:96)
>         at org.springframework.aop.framework.ReflectiveMethodInvocation
> .proceed(ReflectiveMethodInvocation.java:179)
>         at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(
> JdkDynamicAopProxy.java:213)
>         at com.sun.proxy.$Proxy191.importMetadata(Unknown Source)
>         at org.hisp.dhis.importexport.action.util.ImportMetaDataTask.
> call(ImportMetaDataTask.java:99)
>         at org.hisp.dhis.security.SecurityContextRunnable.run(SecurityC
> ontextRunnable.java:57)
>         at org.springframework.scheduling.support.DelegatingErrorHandli
> ngRunnable.run(DelegatingErrorHandlingRunnable.java:54)
>         at java.util.concurrent.Executors$RunnableAdapter.call(Unknown
> Source)
>         at java.util.concurrent.FutureTask.run(Unknown Source)
>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown
> Source)
>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown
> Source)
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown
> Source)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
> Source)
>         at java.lang.Thread.run(Unknown Source)
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>
>
_______________________________________________
Mailing list: https://launchpad.net/~dhis2-users
Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp



_______________________________________________
Mailing list: https://launchpad.net/~dhis2-users
Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp

References