← Back to team overview

dhis2-devs team mailing list archive

Re: 500 error on PATCHing categoryOption on 2.23

 

Hi Trøyel

Actually the PATCH functionality (especially in earlier versions) is not
the best. If you are not using attribute values, then I think you should be
OK (in general only simple properties like name is supported well)

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

On Thu, Mar 2, 2017 at 12:11 AM, Trøyel Nerbø <troyel.nerbo@xxxxxx> wrote:

> Hi all,
>
> I’m trying to batch update my code field on categoryOptions through
> patching the individual UiD’s on /api/categoryOptions/
> xxhDxyT8kCD.json?preheatCache=false .
>
>
>
> My raw json payload only includes the UiD, name and (new) code field. The
> server log gives a preheat and reports success on update. Comparing the
> before and after json the only change happened to the categoryOption is the
> intended one. The only issue I can see on the log side is that the
> preheatCache is not disabled as intended.
>
>
>
> The server log gives the following:
>
> * INFO  2017-03-01 15:45:36,606 Building object-bridge maps (preheatCache:
> true, 6 classes). (DefaultObjectBridge.java [http-apr-8081-exec-9])
>
> * INFO  2017-03-01 15:45:41,828 Building object-bridge maps took 5.21
> seconds. (DefaultObjectBridge.java [http-apr-8081-exec-9])
>
> * INFO  2017-03-01 15:45:42,548 'admin' update org.hisp.dhis.dataelement.DataElementCategoryOption,
> name: AFFM1302 (Norad Education GBV and ICLA), uid: VHqcQwn3cVW
> (AuditLogUtil.java [http-apr-8081-exec-9])
>
>
>
> However in Postman I can see the this error:
>
> *HTTP Status 500 - Request processing failed; nested exception is
> org.hibernate.HibernateException: A collection with
> cascade="all-delete-orphan" was no longer referenced by the owning entity
> instance:
> org.hisp.dhis.dataelement.DataElementCategoryOption.attributeValues*
> ------------------------------
>
> *type* Exception report
>
> *message* *Request processing failed; nested exception is
> org.hibernate.HibernateException: A collection with
> cascade="all-delete-orphan" was no longer referenced by the owning entity
> instance:
> org.hisp.dhis.dataelement.DataElementCategoryOption.attributeValues*
>
> *description* *The server encountered an internal error that prevented it
> from fulfilling this request.*
>
> *exception*
>
> org.springframework.web.util.NestedServletException: Request processing
> failed; nested exception is org.hibernate.HibernateException: A
> collection with cascade="all-delete-orphan" was no longer referenced by the
> owning entity instance: org.hisp.dhis.dataelement.
> DataElementCategoryOption.attributeValues
>
> org.springframework.web.servlet.FrameworkServlet.processRequest(
> FrameworkServlet.java:980)
>
>
>
>
>
> Since I see only the intended change in the catoption json I’m considering
> ignoring this error and running the update. But, before I do does anyone
> think this could lead to any problems down the line that I don’t
> immediately see? The reason I am not using PUT is that I then have to
> re-send the sharing information (for that not to be removed in the process
> as it does in 2.23).
>
>
>
> Thanks!
>
>
>
> Running:
>
> Version:
>
> 2.23
>
> Build revision:
>
> e5bfc4e
>
> Build date:
>
> 2016-12-13 18:01
>
>
>
>
>
>
> Best Regards
> *Halvar Trøyel Nerbø*
> Reporting Advisor
>
> +47 992 39 817
>
> Skype: nrc_troyel
> www.nrc.no
>
> [image: nrclogo] <http://www.nrc.no/>
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>

JPEG image


References