...
In an External Application using web services
See Web Services
In an External Application
...
Using the API 1.8.0+ Jar (maven based)
OpenMRS introduced Maven in 1.8. The easiest way to use the OpenMRS API is to also use maven for your project. Once you do that, simply use these in your pom.xml
...
- When coding against the database API, domain objects (Patients, Users, etc.) provided from the API are only guaranteed to be valid between calls to context.openSession() and context.closeSession().
- You needn't worry about this within a web application environment as long as you are using a filter such as
org.openmrs.web.OpenmrsFilter
(since the filter marks the boundaries around each HTTP request) - You cannot use domain objects across transactions (or requests) (e.g., if you loaded a
Patient
object on one web page, you must reload that object, before using it on subsequent pages)
- You needn't worry about this within a web application environment as long as you are using a filter such as
- It is the developer's responsibility to ensure that context.closeSession() is called (if not within webapp environment) to release precious resources (even in the event of an exception)
- These transaction boundary calls are lightweight -- i.e., there is little penalty for calling them