errors extending order class in a module while creating new order types

i’m creating a procedure order module so i’m extending class order and adding my module to openmrs so that the the context of the ProcedureOrder class can be loaded as an order type once the app loads

when I try to do a getAllOrdersByPatientUuid i’m getting the following error

“error”: { “message”: “[could not resolve property: patient of: org.openmrs.module.procedureorder.models.ProcedureOrder]”, “code”: “org.hibernate.persister.entity.AbstractPropertyMapping:83”, “detail”: "org.hibernate.QueryException: could not resolve property: patient of: org.openmrs.module.procedureorder.models.ProcedureOrder\n\tat org.hibernate.persister.entity.AbstractPropertyMapping.propertyException

  1. Is it possible that my ProcedureOrder class is not being loaded as an ordertype?
  2. If its being loaded, why is the request searching for property patient in the ProcedureOrder whereas it is a property of base class Order [could not resolve property: patient of: org.openmrs.module.procedureorder.models.ProcedureOrder]


@jecihjoy two quick ones

1.Did you update your maven project after pulling it into your IDE , or even running “mvn clean install” so it can pull all dependencies

  1. Can you share your snippet here so we can see ?

i’m creating my omod through mvn clean install so my dependancies are upto date, lemmi share the error



@jecihjoy i do not know how your code looks like ,but does the field or property "patient " that you are trying to reference exist in this Class "org.openmrs.module.procedureorder.models.ProcedureOrder " ?

the field patient only exists in the base class Orders which i’m extending in class ProcedureOrder

i’m trying to create a new type of order, ProcedureOrder but all the methods i could override while saving are declared private, this means i’ll have to transfer all the orders functionality to my module?! Is editing core an option?

@dkayiwa @rickysilas @tendomart

As a starting point, can you give as much details as you can in regards to what this procedure order is going to be used for?

thanks for your response

a procedure such as city scan guided biopsy will require several tests done

from a developers perspective:

ProcedureOrder class would have the following properties

private Order order; private String clinicalHistory; private Concept procedureName; private OrderFrequency frequency;

ProcedureTest class would be a child table of the Procedure class with the following properties

private int testId; private boolean requiresSpecimen; private Concept specimenSource; private int numberOfRepeats; private Laterality laterality; private String testNotes; private ProcedureOrder procedureOrder;

for each type of test in a given procedure, I would require to collect the above data as indicated by the class ProcedureTest properties. I would also like to think that this ProcedureTest class would be best achieved by extending the properties to the OrderSetMembers property. This will enable grouping together of tests to be done in a procedure as an order set


what are your suggestions


Which of those properties are new? As in those properties that are not in any of the existing order and its sub classes?

these properties are in TestOrder class a subclass of order, beside that i wanted for orders of type procedures to be ordetType Procedure, the big challenge is whenever i try to post a payload of ordertype:testorder with concept of type Procedure i’m getting the following error

sample payload

{ “patient”: “1b9144b4-dce5-4088-aff6-8329c9e03b43”, “encounter”: “6cb9d4fe-1981-448d-b206-3726d017569e”, “careSetting”: “6f0c9a92-6f24-11e3-af88-005056821db0”, “concept”: “0589723c-b0fe-4a28-923a-39957f12dd7f”, “orderer”: “7faf1efd-5fb0-431c-93fe-e1441cd65932”, “type”: “testorder” }

link to error


Are you able to reproduce this in a unit test? Here is an example of such a test:

lemmi see how to do this

ordertype testorders only accept concepts from concept class Test, can these be configured so that it can also accept concepts from concept class Procedure

hello @dkayiwa i would greatly appreciate your help on this

I have created a class ProcedureOrder that extends Order class

This is its ResourceSubclasshandler

I have editted the save method here to accomodate saving my procedure order.



if i do a post of ordertype: testorder, it is saved successfully but a post of ordertype: procedureorder i’m getting this error

what is causing this yet i have defined a subclass resource handler for the class ProcedureOrder

as a test case, i have moved the test subclasshandler resource to my module and i’m getting a similar error. This is the error This was however working when the rosource was on the @dkayiwa @darius @mssavai @samprogramiz @corneliouzbett

Did you intentionally withdraw the post where you said that you fixed this?

yes, i was refering to the first issue but it was replying to the issue i’m facing right now which is misleading

any suggestions or workarounds for this?

What issue are you facing now?