I am trying to import legacy data into a new DHIS2 installation using custom code.
While adding new entries into a database table, I need to assign new UID values. What is the algorithm I should use to generated these IDs ? I tried using a postgresql extension called uuid-ossp and the function uuid_generate_v1() that comes with that extension. But it generates uuid of the format ebe87e56-8624-11e6-a4ce-040157be4e01 and it’s bigger than what CHARACTER VARYING(11) can hold. Any idea what strategy should I follow here to easily generate UIDs while inserting database entries?
if you are using the DHIS 2 Java service layers there is no need to manually generate and set UIDs. They will be automatically set before the object is saved.
To generate UIDs you should use this class: org.hisp.dhis.commonCodeGenerator -> generateCode( 11 );
I am trying to import legacy data into a new DHIS2 installation using custom code.
While adding new entries into a database table, I need to assign new UID values. What is the algorithm I should use to generated these IDs ? I tried using a postgresql extension called uuid-ossp and the function uuid_generate_v1() that comes with that extension. But it generates uuid of the format ebe87e56-8624-11e6-a4ce-040157be4e01 and it’s bigger than what CHARACTER VARYING(11) can hold. Any idea what strategy should I follow here to easily generate UIDs while inserting database entries?
On Thu, Sep 29, 2016 at 11:23 AM, Lars Helge Øverland lars@dhis2.org wrote:
Hi Arun,
if you are using the DHIS 2 Java service layers there is no need to manually generate and set UIDs. They will be automatically set before the object is saved.
To generate UIDs you should use this class: org.hisp.dhis.commonCodeGenerator -> generateCode( 11 );
I am trying to import legacy data into a new DHIS2 installation using custom code.
While adding new entries into a database table, I need to assign new UID values. What is the algorithm I should use to generated these IDs ? I tried using a postgresql extension called uuid-ossp and the function uuid_generate_v1() that comes with that extension. But it generates uuid of the format ebe87e56-8624-11e6-a4ce-040157be4e01 and it’s bigger than what CHARACTER VARYING(11) can hold. Any idea what strategy should I follow here to easily generate UIDs while inserting database entries?
On Thu, Sep 29, 2016 at 11:23 AM, Lars Helge Øverland lars@dhis2.org wrote:
Hi Arun,
if you are using the DHIS 2 Java service layers there is no need to manually generate and set UIDs. They will be automatically set before the object is saved.
To generate UIDs you should use this class: org.hisp.dhis.commonCodeGenerator → generateCode( 11 );
I am trying to import legacy data into a new DHIS2 installation using custom code.
While adding new entries into a database table, I need to assign new UID values. What is the algorithm I should use to generated these IDs ? I tried using a postgresql extension called uuid-ossp and the function uuid_generate_v1() that comes with that extension. But it generates uuid of the format ebe87e56-8624-11e6-a4ce-040157be4e01 and it’s bigger than what CHARACTER VARYING(11) can hold. Any idea what strategy should I follow here to easily generate UIDs while inserting database entries?
On Thu, Sep 29, 2016 at 11:23 AM, Lars Helge Øverland lars@dhis2.org wrote:
Hi Arun,
if you are using the DHIS 2 Java service layers there is no need to manually generate and set UIDs. They will be automatically set before the object is saved.
To generate UIDs you should use this class: org.hisp.dhis.commonCodeGenerator -> generateCode( 11 );
I am trying to import legacy data into a new DHIS2 installation using custom code.
While adding new entries into a database table, I need to assign new UID values. What is the algorithm I should use to generated these IDs ? I tried using a postgresql extension called uuid-ossp and the function uuid_generate_v1() that comes with that extension. But it generates uuid of the format ebe87e56-8624-11e6-a4ce-040157be4e01 and it’s bigger than what CHARACTER VARYING(11) can hold. Any idea what strategy should I follow here to easily generate UIDs while inserting database entries?
On Thu, Sep 29, 2016 at 11:23 AM, Lars Helge Øverland lars@dhis2.org wrote:
Hi Arun,
if you are using the DHIS 2 Java service layers there is no need to manually generate and set UIDs. They will be automatically set before the object is saved.
To generate UIDs you should use this class: org.hisp.dhis.commonCodeGenerator -> generateCode( 11 );
I am trying to import legacy data into a new DHIS2 installation using custom code.
While adding new entries into a database table, I need to assign new UID values. What is the algorithm I should use to generated these IDs ? I tried using a postgresql extension called uuid-ossp and the function uuid_generate_v1() that comes with that extension. But it generates uuid of the format ebe87e56-8624-11e6-a4ce-040157be4e01 and it’s bigger than what CHARACTER VARYING(11) can hold. Any idea what strategy should I follow here to easily generate UIDs while inserting database entries?