Unable to setup Testing Environment with Hibernate Annotated Model Classes[SOLVED]

Am using Hibernate annotations over hibernate xml files but am failing to set up a testing environment.

here is my TestingApplicationContext.xml

and added this line in the config.xml

but am still getting NoSuchTableException:

org.dbunit.dataset.NoSuchTableException: hie_Patient


cc @dkayiwa @ibacher

Just change this https://github.com/mozzy11/openmrs-module-HIE_Registry/blob/master/api/src/main/java/org/openmrs/module/hieregistry/HiePatient.java#L11 to javax.persistence.Entity



it worked , thanks @dkayiwa
I want to be like you when i grow up


@mozzy This is just me being picky would be great if you named your module hieregistry (lower case), to be consistent with all other modules

1 Like

Thanks @ssmusoke :slightly_smiling_face: , Surely ill do

@dkayiwa am setting up another test enviroment

but whenever my test class extends BaseModuleContextSensitiveTest

even with a without doing any thing in a test method , it throws ExceptionInInitializerError

I want to load all the Concepts from a dataset and i want to be able to write a test unit that counts the number of concepts added like in the reference metadata module here

Add these dependencies in the pom.xml of your api: https://pastebin.com/QGLQGxc8

Then change the value of your openmrsPlatformVersion property to 2.1.4 and remember to add the legacyui-omod dependency to your omod’s pom.xml

great @dkayiwa , it worked :grinning: , though it i changed openmrsPlatformVersion property to 2.2.0

Hi @dkayiwa , The tests run fine but on loading the module , i get

Unable to start OpenMRS. Error thrown was: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#1' defined in URL [jar:file:/D:/openMrs/code/core/Form_Builder/referenceapplication-standalone-2.10.0/appdata/.openmrs-lib-cache/allergyui/allergyui.jar!/webModuleApplicationContext.xml]: Initialization of bean failed; nested exception is java.lang.LinkageError: loader constraint violation: loader (instance of org/openmrs/util/OpenmrsClassLoader) previously initiated loading for a different type with name "javax/servlet/http/HttpServletRequest"

see full log https://pastebin.com/RJNP31nn

Ensure that you have scope provided on your servlet dependency.

1 Like

Thanks @dkayiwa , worked pretty fine :grinning:

hi @dkayiwa , am trying to build the IsantePlus reports module locally but am encountering some failures ,

Could not resolve dependencies for project org.openmrs.module:isanteplusreports-api:jar:1.1-SNAPSHOT: Failed to collect dependencies at org.openmrs.module:isanteplus-api:jar:1.2-SNAPSHOT:

Full error at

,some ideas

1 Like