Hi Morten, I have created users using the UI, and not Web API. I was not updating users, just creating them. I took an export of metadata from one DHIS instance (including users) and then tried to import the metadata into another. But import fails at users.
[image: Inline image 1] And here are the logs generated: ** INFO * 2016-02-05 10:51:43,742 [Level: INFO, category: METADATA_IMPORT, time: Fri Feb 05 10:51:43 IST 2016, message: Importing 5 Users] (InMemoryNotifier.java [taskScheduler-1]) * *INFO * 2016-02-05 10:51:43,761 'admin' update org.hisp.dhis.user.User, name: admin123 admin123, uid: TGk0oxuEY35 (AuditLogUtil.java [taskScheduler-1]) * *ERROR* 2016-02-05 10:51:43,777 Unexpected error occurred in scheduled task. (TaskUtils.java [taskScheduler-1]) org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.hisp.dhis.user.User at org.hibernate.engine.internal.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:249) at org.hibernate.type.EntityType.getIdentifier(EntityType.java:536) at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:311) at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:321) at org.hibernate.type.TypeHelper.findDirty(TypeHelper.java:294) at org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:4049) at org.hibernate.event.internal.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:537) at org.hibernate.event.internal.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:235) at org.hibernate.event.internal.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:164) at org.hibernate.event.internal.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:230) at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:100) at org.hibernate.event.internal.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:61) at org.hibernate.internal.SessionImpl.autoFlushIfRequired(SessionImpl.java:1166) at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1616) at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:374) at org.hibernate.internal.CriteriaImpl.uniqueResult(CriteriaImpl.java:396) at org.hisp.dhis.hibernate.HibernateGenericStore.getObject(HibernateGenericStore.java:291) at org.hisp.dhis.organisationunit.hibernate.HibernateOrganisationUnitStore.getByUuid(HibernateOrganisationUnitStore.java:81) at org.hisp.dhis.organisationunit.DefaultOrganisationUnitService.getOrganisationUnitByUuid(DefaultOrganisationUnitService.java:224) Thanks. Archana Chillala Application Developer Email [email protected] Telephone +91 9100960533 <+91+9100960533> [image: ThoughtWorks] <http://www.thoughtworks.com/?utm_campaign=archana-chillala-signature&utm_medium=email&utm_source=thoughtworks-email-signature-generator> On Fri, Feb 5, 2016 at 9:52 AM, Morten Olav Hansen < [email protected]> wrote: > I was able to create a user using the web-api with no issues, could you > please share your full payload and exception? also, were you updating > users or creating new ones? I need a bit more info to be able to > reproduce. > > -- > You received this bug notification because you are subscribed to the bug > report. > https://bugs.launchpad.net/bugs/1538443 > > Title: > Metadata import of users fails > > Status in DHIS: > New > > Bug description: > I am using two instances of DHIS. I have exported metadata from one > instance of DHIS and imported that into another instance of DHIS. But the > import process fails at users. When I try importing metadata without > "users", import is successful. > While importing metadata with users, The log says - "object references > an unsaved transient instance". I have also gone through some threads > raising similar issues, and heard that import of users is disabled or not > supported. If so, is there a way we can import users? Could you please > elaborate on that. > > Current user: > admin > Version: > 2.21 > Build revision: > 20983 > User agent: > Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 > (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36 > > To manage notifications about this bug go to: > https://bugs.launchpad.net/dhis2/+bug/1538443/+subscriptions > ** Attachment added: "Screen Shot 2016-02-05 at 10.51.56.png" https://bugs.launchpad.net/bugs/1538443/+attachment/4564309/+files/Screen%20Shot%202016-02-05%20at%2010.51.56.png -- You received this bug notification because you are a member of DHIS 2 developers, which is subscribed to DHIS. https://bugs.launchpad.net/bugs/1538443 Title: Metadata import of users fails Status in DHIS: New Bug description: I am using two instances of DHIS. I have exported metadata from one instance of DHIS and imported that into another instance of DHIS. But the import process fails at users. When I try importing metadata without "users", import is successful. While importing metadata with users, The log says - "object references an unsaved transient instance". I have also gone through some threads raising similar issues, and heard that import of users is disabled or not supported. If so, is there a way we can import users? Could you please elaborate on that. Current user: admin Version: 2.21 Build revision: 20983 User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36 To manage notifications about this bug go to: https://bugs.launchpad.net/dhis2/+bug/1538443/+subscriptions _______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : [email protected] Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp

