# FORM FILTER MODULE ERROR "HTTP Status 500 - Request processing failed; nested exception is org.hibernate.exception.GenericJDBCException:"

**URL:** <https://talk.openmrs.org/t/form-filter-module-error-http-status-500-request-processing-failed-nested-exception-is-org-hibernate-exception-genericjdbcexception/18064>\
**Category:** Development\
**Created:** [May 17, 2018, 12:06pm UTC](https://talk.openmrs.org/t/form-filter-module-error-http-status-500-request-processing-failed-nested-exception-is-org-hibernate-exception-genericjdbcexception/18064 "2018-05-17T12:06:19Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![mozzy](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mozzy/32/11815_2.png) [@mozzy](https://talk.openmrs.org/u/mozzy)\
**Post date:** [May 17, 2018, 12:06pm UTC](https://talk.openmrs.org/t/form-filter-module-error-http-status-500-request-processing-failed-nested-exception-is-org-hibernate-exception-genericjdbcexception/18064/1 "2018-05-17T12:06:19Z")

</div>

am updating the Form Filter Module torun on platform 2+ , it loads succesfuly , but when i click on a form to filter, it returns this error

[https://hastebin.com/obukokiheb.swift](https://hastebin.com/obukokiheb.swift)

how do i go about it.

@dkayiwa@tendomart@darius@wyclif

here is the code [https://github.com/mozzy11/openmrs-module-formfilter/tree/PLAT-39](https://github.com/mozzy11/openmrs-module-formfilter/tree/PLAT-39)

---

<div class="post-metadata">

**Author:** ![tendomart](https://talk.openmrs.org/user_avatar/talk.openmrs.org/tendomart/32/6753_2.png) [@tendomart](https://talk.openmrs.org/u/tendomart)\
**Post date:** [May 17, 2018, 2:04pm UTC](https://talk.openmrs.org/t/form-filter-module-error-http-status-500-request-processing-failed-nested-exception-is-org-hibernate-exception-genericjdbcexception/18064/2 "2018-05-17T14:04:40Z")

</div>

@mozzy are there any new changes to the tables or any new models introduced?

---

<div class="post-metadata">

**Author:** ![mozzy](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mozzy/32/11815_2.png) [@mozzy](https://talk.openmrs.org/u/mozzy)\
**Post date:** [May 17, 2018, 2:43pm UTC](https://talk.openmrs.org/t/form-filter-module-error-http-status-500-request-processing-failed-nested-exception-is-org-hibernate-exception-genericjdbcexception/18064/3 "2018-05-17T14:43:58Z")

</div>

no , i havent yet introduced any changes to to the tables .

here is the commit

> <https://github.com/mozzy11/openmrs-module-formfilter/commit/a190786ccc68c5ce0f265751a0743272cd1fe5f5>

---

<div class="post-metadata">

**Author:** ![darius](https://talk.openmrs.org/user_avatar/talk.openmrs.org/darius/32/8082_2.png) [@darius](https://talk.openmrs.org/u/darius)\
**Post date:** [May 18, 2018, 4:08pm UTC](https://talk.openmrs.org/t/form-filter-module-error-http-status-500-request-processing-failed-nested-exception-is-org-hibernate-exception-genericjdbcexception/18064/4 "2018-05-18T16:08:37Z")

</div>

If you look at the error message, it says

> Connection is read-only. Queries leading to data modification are not allowed

I peeked at the code. In fact it is doing something illegal. The code in [FormFilterServiceImpl:75](https://github.com/mozzy11/openmrs-module-formfilter/blob/master/api/src/main/java/org/openmrs/module/formfilter/api/impl/FormFilterServiceImpl.java#L75) in fact creates a new form filter object and then returns it. But [this line of code](https://github.com/mozzy11/openmrs-module-formfilter/blob/master/api/src/main/java/org/openmrs/module/formfilter/api/FormFilterService.java#L51) declares it should be in a read-only transaction. So the code is incorrect, and Hibernate is correct to throw this error.

It seems this was added in [this commit,](https://github.com/mozzy11/openmrs-module-formfilter/commit/44f89487de21a4c5b746b3a407b8b5f540d8ec0d) from 2012, but the commit message does not say why this is done.

@ningosi, can you comment on how eSaude is using this module? E.g. are you purely configuring it via the API or something, thus you don’t hit this bug in the UI?

---

<div class="post-metadata">

**Author:** ![ningosi](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ningosi/32/8060_2.png) [@ningosi](https://talk.openmrs.org/u/ningosi)\
**Post date:** [May 18, 2018, 6:37pm UTC](https://talk.openmrs.org/t/form-filter-module-error-http-status-500-request-processing-failed-nested-exception-is-org-hibernate-exception-genericjdbcexception/18064/5 "2018-05-18T18:37:16Z")

</div>

Version 1.0.0 just run fine of 1.11.5 and after filtering forms via such, I am able to click on it and it loads properly. We just use the module on the patient dashboard. See the attached for review ![filtering](https://talk.openmrs.org/uploads/default/original/2X/c/c53634b6509f10c5f60eb4c274cd85ebfb6101f0.png) and clicking on one loads without errors

---

<div class="post-metadata">

**Author:** ![darius](https://talk.openmrs.org/user_avatar/talk.openmrs.org/darius/32/8082_2.png) [@darius](https://talk.openmrs.org/u/darius)\
**Post date:** [May 18, 2018, 6:53pm UTC](https://talk.openmrs.org/t/form-filter-module-error-http-status-500-request-processing-failed-nested-exception-is-org-hibernate-exception-genericjdbcexception/18064/6 "2018-05-18T18:53:52Z")

</div>

~~@mozzy I think the correct approach here would be to Branch off at the last known good release, and make a release like 1.0.1 that supports platform 2.x.~~

---

<div class="post-metadata">

**Author:** ![darius](https://talk.openmrs.org/user_avatar/talk.openmrs.org/darius/32/8082_2.png) [@darius](https://talk.openmrs.org/u/darius)\
**Post date:** [May 18, 2018, 7:12pm UTC](https://talk.openmrs.org/t/form-filter-module-error-http-status-500-request-processing-failed-nested-exception-is-org-hibernate-exception-genericjdbcexception/18064/7 "2018-05-18T19:12:01Z")

</div>

I had made a suggestion just from reading Nicholas’s comment, but now that I peek at the code I don’t think it will work.

@ningosi the offending code is present in the 1.0.0 tag also. Can you verify if this works after you create a new form, and click on it the first time?

(@mozzy what are your steps to reproduce this error? between creating a form, installing the module, etc, what order do you do things?)

---

<div class="post-metadata">

**Author:** ![mozzy](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mozzy/32/11815_2.png) [@mozzy](https://talk.openmrs.org/u/mozzy)\
**Post date:** [May 21, 2018, 7:06am UTC](https://talk.openmrs.org/t/form-filter-module-error-http-status-500-request-processing-failed-nested-exception-is-org-hibernate-exception-genericjdbcexception/18064/8 "2018-05-21T07:06:05Z")

</div>

the module installs succesfully, and starts succesfully, but when i click on “manage Form Filtering” and i try to select a form, then it throws the error

---

<div class="post-metadata">

**Author:** ![mozzy](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mozzy/32/11815_2.png) [@mozzy](https://talk.openmrs.org/u/mozzy)\
**Post date:** [May 21, 2018, 7:14am UTC](https://talk.openmrs.org/t/form-filter-module-error-http-status-500-request-processing-failed-nested-exception-is-org-hibernate-exception-genericjdbcexception/18064/9 "2018-05-21T07:14:27Z")

</div>

![image](https://talk.openmrs.org/uploads/default/original/2X/6/61ba31e002f1e62bc021200b771843f86c3cf464.png)

it fails at this level

---

<div class="post-metadata">

**Author:** ![mozzy](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mozzy/32/11815_2.png) [@mozzy](https://talk.openmrs.org/u/mozzy)\
**Post date:** [May 21, 2018, 7:15am UTC](https://talk.openmrs.org/t/form-filter-module-error-http-status-500-request-processing-failed-nested-exception-is-org-hibernate-exception-genericjdbcexception/18064/10 "2018-05-21T07:15:09Z")

</div>

![image](https://talk.openmrs.org/uploads/default/original/2X/6/684851ca4907759f4bc885eef5ff3f93353b4074.png)

---

<div class="post-metadata">

**Author:** ![ningosi](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ningosi/32/8060_2.png) [@ningosi](https://talk.openmrs.org/u/ningosi)\
**Post date:** [May 21, 2018, 12:09pm UTC](https://talk.openmrs.org/t/form-filter-module-error-http-status-500-request-processing-failed-nested-exception-is-org-hibernate-exception-genericjdbcexception/18064/11 "2018-05-21T12:09:51Z")

</div>

I just created an html form in 1.11.5 running 1.0 version of form filter and clicked on it, filled the observations and saved successfully. Let me try testing @mozzy PR in 2.x and see what happens

---

<div class="post-metadata">

**Author:** ![mozzy](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mozzy/32/11815_2.png) [@mozzy](https://talk.openmrs.org/u/mozzy)\
**Post date:** [May 24, 2018, 7:12am UTC](https://talk.openmrs.org/t/form-filter-module-error-http-status-500-request-processing-failed-nested-exception-is-org-hibernate-exception-genericjdbcexception/18064/12 "2018-05-24T07:12:17Z")

</div>

@ningosi wat could be your test results

---

<div class="post-metadata">

**Author:** ![ningosi](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ningosi/32/8060_2.png) [@ningosi](https://talk.openmrs.org/u/ningosi)\
**Post date:** [May 24, 2018, 7:23am UTC](https://talk.openmrs.org/t/form-filter-module-error-http-status-500-request-processing-failed-nested-exception-is-org-hibernate-exception-genericjdbcexception/18064/13 "2018-05-24T07:23:54Z")

</div>

Let me test it today. I have been out sick since last week. I will communicate

---

<div class="post-metadata">

**Author:** ![mozzy](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mozzy/32/11815_2.png) [@mozzy](https://talk.openmrs.org/u/mozzy)\
**Post date:** [May 24, 2018, 7:25am UTC](https://talk.openmrs.org/t/form-filter-module-error-http-status-500-request-processing-failed-nested-exception-is-org-hibernate-exception-genericjdbcexception/18064/14 "2018-05-24T07:25:32Z")

</div>

sorry about that bro…

---

<div class="post-metadata">

**Author:** ![mozzy](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mozzy/32/11815_2.png) [@mozzy](https://talk.openmrs.org/u/mozzy)\
**Post date:** [May 24, 2018, 7:29am UTC](https://talk.openmrs.org/t/form-filter-module-error-http-status-500-request-processing-failed-nested-exception-is-org-hibernate-exception-genericjdbcexception/18064/15 "2018-05-24T07:29:43Z")

</div>

coz i was trying to solve that error, i pushed more than one commit and havent yet squashed them . but u can use the comits here

[https://github.com/openmrs/openmrs-module-formfilter/pull/1/commits/c3a327cd6a6151f4b604b7ed62601aa2635217a4](https://github.com/openmrs/openmrs-module-formfilter/pull/1/commits/c3a327cd6a6151f4b604b7ed62601aa2635217a4) for the test

---

<div class="post-metadata">

**Author:** ![ningosi](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ningosi/32/8060_2.png) [@ningosi](https://talk.openmrs.org/u/ningosi)\
**Post date:** [May 24, 2018, 8:16am UTC](https://talk.openmrs.org/t/form-filter-module-error-http-status-500-request-processing-failed-nested-exception-is-org-hibernate-exception-genericjdbcexception/18064/16 "2018-05-24T08:16:06Z")

</div>

Testing platform version 2.0.5, form filter module version 1.2(I checked out that tag from master)

The module loaded and started successfully. When I click on **Manage Form Filtering** , the list of forms appears, When I click on any one of the available form I get error as you reported. When I load the patient dashboard(having patient context) and click on **Form Entry** tab am able to load the form without errors(That has been our use case)

I think it makes sense for the second results in that every form should be filled for a patient, or before filling a form, one should be in a patient context. I maybe wrong maybe that module intention was to fit in both settings, please correct me @darius. Maybe this module do not need that extension point on the UI, or on clicking on it, one must be forced to select a patient.

---

<div class="post-metadata">

**Author:** ![mozzy](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mozzy/32/11815_2.png) [@mozzy](https://talk.openmrs.org/u/mozzy)\
**Post date:** [May 25, 2018, 8:53am UTC](https://talk.openmrs.org/t/form-filter-module-error-http-status-500-request-processing-failed-nested-exception-is-org-hibernate-exception-genericjdbcexception/18064/17 "2018-05-25T08:53:15Z")

</div>

so what the way forwad , as per @ningosi results??

@burke@darius@tendomart@dkayiwa

---

<div class="post-metadata">

**Author:** ![darius](https://talk.openmrs.org/user_avatar/talk.openmrs.org/darius/32/8082_2.png) [@darius](https://talk.openmrs.org/u/darius)\
**Post date:** [May 25, 2018, 7:07pm UTC](https://talk.openmrs.org/t/form-filter-module-error-http-status-500-request-processing-failed-nested-exception-is-org-hibernate-exception-genericjdbcexception/18064/18 "2018-05-25T19:07:44Z")

</div>

@mozzy there are several possible approaches here (going from worst to best)

1. Say that “it was already broken in the UI, but it works for @ningosi in their use case, so this is good enough” so just release this as-is
2. Do the quickest hack to make the code work (remove read-only from [here](https://github.com/mozzy11/openmrs-module-formfilter/blob/master/api/src/main/java/org/openmrs/module/formfilter/api/FormFilterService.java#L51))
3. Explore the code, understand what it’s currently trying to do, and then refactor it so that (a) getFormFilter(Form) is read-only, (b) but it otherwise behaves as intended. I presume this means moving the “create new FormFilter object for a Form” logic from the service into the web controller.

Even #1 is “good enough” at a basic level; it depends on how much time you have to look into this.

---

<div class="post-metadata">

**Author:** ![mozzy](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mozzy/32/11815_2.png) [@mozzy](https://talk.openmrs.org/u/mozzy)\
**Post date:** [May 28, 2018, 11:40am UTC](https://talk.openmrs.org/t/form-filter-module-error-http-status-500-request-processing-failed-nested-exception-is-org-hibernate-exception-genericjdbcexception/18064/19 "2018-05-28T11:40:07Z")

</div>

thx @darius ive taken option 2 and it works pretty fine
