Find - possible problem

I am building a Kettle tranform to load species & breed data from a csv file. As part of the testing, I ran the transform to load the 3 species, then used Administration|Lookups to check the data loaded.  Humm error - all set to Default, so I deleted the 3 species, fixed my code, and re-ran the transform.

Then I pressed the Find button - however the 3 species which should have re-appeared did not. Humm - tried logging off and on again - still not there.

Clutching at straws, I changed the Active pulldown from Yes to Both, and clicked Find - ahah - the expected 3 species appeared - and they were active.

I think that what is happening is that the OpenVPMS code is caching the data - and hence, because it has seen no updates (because I am updating via Kettle), it uses the cached results and thus does not see the 3 species that Kettle loaded.  Changing Active from yes to Both forces it to re-do the database access and hence the 3 species added by Kettle appear.

I do not think that we need to change anything in the code - we need to keep as much caching as possible. Howevever, implementors/developers need to understand that this caching is present, and that if you change the database externally to the OpenVPMS code (eg using Kettle or SQL) then you may not see the changes you expect.  Logging off & on again is not enough, you really need a Tomcat restart to flush all the caches.

Regards, Tim G

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Find - possible problem

There are multiple caches within OpenVPMS.

In general, if you update the database outside OpenVPMS, the changes:

  • won't be seen immediately; or
  • won't be seen until the object is edited, assuming it is not in the second level cache
  • won't be seen till restart

The major caches are listed below:

1. Hibernate's second level cache, configured by ehcache.xml

Elements in this cache are set with the flag eternal="true", which means that they don't expire unless the cache capacity is reached, in which case the least recently used will be tossed out.

2. Archetypes

Elements in this cache can only be updated by:

  • editing/loading archetypes via Administration - Archetypes
  • Tomcat restart

3. Lookups

Elements in this cache can be updated:

  • by editing via Administration - Lookups
  • when cache capacity is exceeded - least recently used elements are discarded
  • on low memory - elements will be shed from the cache to reclaim memory
  • by Tomcat restart

4. Appointments/tasks

Elements in this cache can be updated:

  • by editing via Workflow - Scheduling, Workflow - Tasks
  • when cache capacity is exceeded - least recently used elements are discarded
  • on low memory - elements will be shed from the cache to reclaim memory
  • by Tomcat restart

5. Current user context

This includes the current:

  • practice
  • practice location
  • stock location
  • schedule view
  • schedule
  • work list view
  • work list
  • customer
  • patient
  • clinician
  • user
  • till
  • deposit account

Refreshed by:

  • switching objects (e.g changing practice locations).
  • logging out/in

 

Syndicate content