Database update - cache problem

Most of the time, I want to cache data from my database for performance reasons. But I have one instance where data is being cached at a time when I don’t want that to happen. Can someone tell me how to avoid this? I have a mysql database which I am accessing and updating using EclipseLink. One table, however, may get information added to it by an external user who can simply invoke mysql at the command line and modify a data record. When that happens, my program will not pick up the modified data the next time it reads the table. Stopping and restarting the program causes it to pick up the correct data, so the problem is data caching.

I access the code like this:


private static JPAContainer<ExtractorStatus> jcExtractor_Status = new JPAContainer<ExtractorStatus>(ExtractorStatus.class);

	public ExtractorStatus getEStatus(){		
		em = getEntityManager();
		MutableLocalEntityProvider<ExtractorStatus> mep = new MutableLocalEntityProvider<ExtractorStatus>(ExtractorStatus.class, em);
		jcExtractor_Status.setEntityProvider(mep);

		ExtractorStatus ses = jcExtractor_Status.getItem(jcExtractor_Status.firstItemId()).getEntity();

		return(ses);
	}

Is there a different entity provider I should be using to force this table to be re-read every time this routine is called?

Thanks,

nbc

I’m still having problems with the JPAContainers. I have a simple routine to load a container:


   public JPAContainer<myRecord> jc_MyRecord = null;

  public JPAContainer<MyRecord> getAllRecords(boolean reload){
    if(reload == true){
      jc_MyRecord = null;
    }
    if(jc_MyRecord == null){
      em = getEntityManager();
      jc_MyRecord = JPAContainerFactory.make(myRecord.class, em);    //  ***** 1111
      jc_MyRecord.refresh();     // **** 2222
    }
    return(jc_MyRecord);
  }

1111:  I have tried changing this to makeNonCached as well - no change in results
2222:  I have tried it with and without this line...

If I update a record in the JPAContainer, it works fine. But I have an external program that periodically updates the database (mysql). Changes made from that program do not show up in my web app unless I stop and restart the Tomcat server. What do I have to do to force the JPAContainer to reload the data from the database? I can see the changes if I open a mysql command session, but the web app simply won’t reload the records.

Thanks,

nbc