PATCH HTTP 500 error

Hello dhis2-devs

I’m trying to make use of the PATCH functionality to simplify a deployment and it looks to get all but finished, and then barfs the following error:

HTTP Status 500 - Request processing failed; nested exception is org.hibernate.HibernateException: identifier of an instance of org.hisp.dhis.dataentryform.DataEntryForm was altered from 2212129 to 0

The command I’m running is the following (I’ve obfuscated certain elements)

curl -X PATCH -d @patch.xml -H “Content-Type: application/xml” -u tharding@baosystems.com:myPass “http://localhost:8080/dhis/api/dataSets/a1234567890

The file structure of the file is the following

Inline image 1

The log file says the following:

  • INFO 2016-03-23 06:39:53,646 ‘tharding@baosystems.com’ update org.hisp.dhis.dataset.DataSet, name: MyDataset, uid: a1234567890 (AuditLogUtil.java [http-bio-8080-exec-10])

The full error is attached.

patcherror.html (23 KB)

···

Timothy Harding
Sr. Systems Analyst, BAO Systems

+1 202-536-1541 | tharding@baosystems.com | http://www.baosystems.com | Skype: hardingt@gmail.com | 2900 K Street, Suite 404, Washington D.C. 20007

Forgot to post the server version:

Version:
2.21
Build revision:
21048

image

image

···

On Wed, Mar 23, 2016 at 9:53 AM, Timothy Harding tharding@baosystems.com wrote:

Hello dhis2-devs

I’m trying to make use of the PATCH functionality to simplify a deployment and it looks to get all but finished, and then barfs the following error:

HTTP Status 500 - Request processing failed; nested exception is org.hibernate.HibernateException: identifier of an instance of org.hisp.dhis.dataentryform.DataEntryForm was altered from 2212129 to 0

The command I’m running is the following (I’ve obfuscated certain elements)

curl -X PATCH -d @patch.xml -H “Content-Type: application/xml” -u tharding@baosystems.com:myPass “http://localhost:8080/dhis/api/dataSets/a1234567890

The file structure of the file is the following

The log file says the following:

  • INFO 2016-03-23 06:39:53,646 ‘tharding@baosystems.com’ update org.hisp.dhis.dataset.DataSet, name: MyDataset, uid: a1234567890 (AuditLogUtil.java [http-bio-8080-exec-10])

The full error is attached.

Timothy Harding
Sr. Systems Analyst, BAO Systems

+1 202-536-1541 | tharding@baosystems.com | http://www.baosystems.com | Skype: hardingt@gmail.com | 2900 K Street, Suite 404, Washington D.C. 20007

Timothy Harding
Sr. Systems Analyst, BAO Systems

+1 202-536-1541 | tharding@baosystems.com | http://www.baosystems.com | Skype: hardingt@gmail.com | 2900 K Street, Suite 404, Washington D.C. 20007

Hi

I think you might have to do a full update of the object. PATCH functionality is a bit flaky at the moment, and really only works with simple properties (strings, numbers etc).

I’m currently building a new importer for 2.23/2.24 and I’m hoping to have a much more robust PATCH functionality there (probably for 2.24)

Please also note that this object changed in going from 2.21 to 2.22, and data entry forms are now what we call an id object, which means it needs to be referenced instead, and we have a endpoint called /api/dataEntryForms for it

image

image

···

On Wed, Mar 23, 2016 at 8:58 PM, Timothy Harding tharding@baosystems.com wrote:

Forgot to post the server version:

Version:
2.21
Build revision:
21048


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Morten Olav Hansen

Senior Engineer, DHIS 2

University of Oslo

http://www.dhis2.org

Timothy Harding
Sr. Systems Analyst, BAO Systems

+1 202-536-1541 | tharding@baosystems.com | http://www.baosystems.com | Skype: hardingt@gmail.com | 2900 K Street, Suite 404, Washington D.C. 20007

On Wed, Mar 23, 2016 at 9:53 AM, Timothy Harding tharding@baosystems.com wrote:

Hello dhis2-devs

I’m trying to make use of the PATCH functionality to simplify a deployment and it looks to get all but finished, and then barfs the following error:

HTTP Status 500 - Request processing failed; nested exception is org.hibernate.HibernateException: identifier of an instance of org.hisp.dhis.dataentryform.DataEntryForm was altered from 2212129 to 0

The command I’m running is the following (I’ve obfuscated certain elements)

curl -X PATCH -d @patch.xml -H “Content-Type: application/xml” -u tharding@baosystems.com:myPass “http://localhost:8080/dhis/api/dataSets/a1234567890

The file structure of the file is the following

The log file says the following:

  • INFO 2016-03-23 06:39:53,646 ‘tharding@baosystems.com’ update org.hisp.dhis.dataset.DataSet, name: MyDataset, uid: a1234567890 (AuditLogUtil.java [http-bio-8080-exec-10])

The full error is attached.

Timothy Harding
Sr. Systems Analyst, BAO Systems

+1 202-536-1541 | tharding@baosystems.com | http://www.baosystems.com | Skype: hardingt@gmail.com | 2900 K Street, Suite 404, Washington D.C. 20007

Thanks Morten,

Good to hear that PATCH is getting a facelift in 2.23/2.24. We ended up doing a full update on the object with the preheatcache set to FALSE (saved a lot of time).

Question about the dataEntryForm, are you saying that these are now completely separate objects to dataSet? As in, the dataSet will reference a dataEntryForm just like it would reference a categoryCombo?

image

image

···

On Wed, Mar 23, 2016 at 11:11 PM, Morten Olav Hansen morten@dhis2.org wrote:

Hi

I think you might have to do a full update of the object. PATCH functionality is a bit flaky at the moment, and really only works with simple properties (strings, numbers etc).

I’m currently building a new importer for 2.23/2.24 and I’m hoping to have a much more robust PATCH functionality there (probably for 2.24)

Please also note that this object changed in going from 2.21 to 2.22, and data entry forms are now what we call an id object, which means it needs to be referenced instead, and we have a endpoint called /api/dataEntryForms for it

Timothy Harding
Sr. Systems Analyst, BAO Systems

+1 202-536-1541 | tharding@baosystems.com | http://www.baosystems.com | Skype: hardingt@gmail.com | 2900 K Street, Suite 404, Washington D.C. 20007

Morten Olav Hansen

Senior Engineer, DHIS 2

University of Oslo

http://www.dhis2.org

On Wed, Mar 23, 2016 at 8:58 PM, Timothy Harding tharding@baosystems.com wrote:

Forgot to post the server version:

Version:
2.21
Build revision:
21048


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Timothy Harding
Sr. Systems Analyst, BAO Systems

+1 202-536-1541 | tharding@baosystems.com | http://www.baosystems.com | Skype: hardingt@gmail.com | 2900 K Street, Suite 404, Washington D.C. 20007

On Wed, Mar 23, 2016 at 9:53 AM, Timothy Harding tharding@baosystems.com wrote:

Hello dhis2-devs

I’m trying to make use of the PATCH functionality to simplify a deployment and it looks to get all but finished, and then barfs the following error:

HTTP Status 500 - Request processing failed; nested exception is org.hibernate.HibernateException: identifier of an instance of org.hisp.dhis.dataentryform.DataEntryForm was altered from 2212129 to 0

The command I’m running is the following (I’ve obfuscated certain elements)

curl -X PATCH -d @patch.xml -H “Content-Type: application/xml” -u tharding@baosystems.com:myPass “http://localhost:8080/dhis/api/dataSets/a1234567890

The file structure of the file is the following

The log file says the following:

  • INFO 2016-03-23 06:39:53,646 ‘tharding@baosystems.com’ update org.hisp.dhis.dataset.DataSet, name: MyDataset, uid: a1234567890 (AuditLogUtil.java [http-bio-8080-exec-10])

The full error is attached.

Timothy Harding
Sr. Systems Analyst, BAO Systems

+1 202-536-1541 | tharding@baosystems.com | http://www.baosystems.com | Skype: hardingt@gmail.com | 2900 K Street, Suite 404, Washington D.C. 20007

Yes, just refer to it like you would with any other object reference (we
also now have /api/dataEntryForms)

···

On Wed, Mar 30, 2016 at 9:27 PM, Timothy Harding <tharding@baosystems.com> wrote:

Question about the dataEntryForm, are you saying that these are now
completely separate objects to dataSet? As in, the dataSet will reference a
dataEntryForm just like it would reference a categoryCombo?

--
Morten Olav Hansen
Senior Engineer, DHIS 2
University of Oslo