org.hibernate.QueryException: could not resolve property: startDate of: org.openmrs.DrugOrder

I have just upgraded to platform 1.12.0 and I am unable to run unit tests involving drug orders. I have established the error to be associated with order activation field.

The generated query keeps referencing startDate yet my module depends on openmrs 1.12.0 and reporting The generated query looks like below:

select do.patient.patientId as patientId, do as do from org.openmrs.DrugOrder as do where do.voided = :param1 and do.patient.patientId in (2,6,7,8,999) and do.concept in (:param2) and do.startDate <= :param3

Any idea on what I could be doing wrong? Thanks in advance

@dkayiwa @wyclif @mseaton

1 Like

Are you running the reference application or core with a couple of modules?

Typically not all module versions will support the all core versions. I would say make sure you have upgraded all your modules to their latest versions.

This is KenyaEMR.

@aojwang can you point us to the unit tests that are failing please?

Hi @mseaton. An example unit test is at this link and it fails when evaluating DrugOrdersForPatientDataDefinition. Please let me know if I need to provide more information.


@aojwang, the DrugOrdersForPatientDataEvaluator is designed to adjust for differences in the drug order model between versions 1.9 and 1.10 in OpenMRS. Have you updated your pom.xml to change openMRSVersion to the appropriate version? Can you debug your unit test to see the value of OpenmrsConstants.OPENMRS_VERSION_SHORT? This is what the evaluator is looking at.


I had also expected it to adjust as you have explained. I debugged and even added (ModuleUtil.compareVersion( OpenmrsConstants.OPENMRS_VERSION_SHORT, “1.10”) to the test to get the value. It always evaluated to -1 and that is what made me think that may be there is some configuration I didn’t get right.

That constant had a value of ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}. It wasn’t a number

@aojwang, ensure you are setting both openMRSVersion and openMRSMinorVersion in your pom. See how the reporting module does it here.

Thanks Mike. I already did that as shown below:


<openMRSVersion>1.12.0</openMRSVersion> <openMRSMinorVersion>1.10</openMRSMinorVersion>

Unfortunately some things have broken the code so am looking at it. I will get back when I am ready to debug the test again.


You can’t have a version of 1.12.0 and a minorVersion of 1.10.

I would try:

  • openMRSVersion = 1.12.0
  • openMRSMinorVersion = 1.12


Thanks Mike. I am making that change now.