I've got a web application that pulls data in the database then shows it. The problem I am getting is the fact that every hour I wish to do updates around the data within the database this is accomplished with a separate application, all of this works fine. However, once it has happened and also the user refreshes their web site, the brand new data is not being displayed.

I really hope this will make sense.

I'll provide some code in the application to ensure that the thing is it better.

My web application is designed in netbeans using java and I've got a persistence unit that's mapping classes to tables within the database. I am using wicket to include my components to my html.

// Java Wicket code

ApplicationSettings apset = new ApplicationSettingsDAO().getApplicationSettings();    
this.add(new Label("lblGameTime", "" + apset.getGameTimeDays()));

// Wicket web coding

Date : day <span wicket:id="lblGameTime">generated date</span>

// DAO application configurations which will get the configurations object in the db and returns it towards the Java Wicket code above

public ApplicationSettings getApplicationSettings() {

    ApplicationSettings settings;

    try {
     Query q = manager.createQuery("select s from ApplicationSettings s where s.setting = :setting");
     q.setParameter("setting", "setting");
     settings = (ApplicationSettings) q.getSingleResult();
  } catch (NoResultException e) {
     ApplicationSettings newSetting = new ApplicationSettings();
     return newSetting;
  }
     return settings;

//ApplicationSettings is only the class.

//Hourly code went in another application that actually works and does update db

Query query6 = manager.createQuery("select s from ApplicationSettings s where s.setting = :setting");
    query6.setParameter("setting", "setting");
    ApplicationSettings apset = (ApplicationSettings) query6.getSingleResult();
    apset.setGameTimeDays(apset.getGameTimeDays() + 1);
    save(apset);

Now once the user loads the page again I'd expect the gameTimeDays could be correct because the page would obtain the data in the db again because it'd call the java wicket code above. However the value doesn't change. The worthiness that turns up around the page may be the old stale value prior to the update. Regardless of the number of updates occur this value remains the old value. If however I perform a redeploy or restart the module within the tomcat server, the worthiness will be correct for your instant.

What shall we be held missing, this can be a small problem the answer appears to become alluding me.

The worthiness appears to become saved in memory up until the server is redeployed or something like that. I have no idea alot about intricacies of java to understand about this.

Ok I really hope I provided enough info for somebody that helped me to with my dilemma.

Thank you for any help.

EDIT: persistence library is TopLink Necessities

Seems like your computer data has been cached through the persistence mechanism you utilize (about that you simply don't disclose particulars). This isn't an element of Java, but those of specific persistence frameworks like e.g. Hibernate.

Should you tell us much more about your persistence provider, we might have the ability to give more concrete advice.

You are able to disable the shared cache in TopLink while using persistence.xml property,

Or disable it per Entity, or use refreshing or cache invalidation.

EclipseLink provider more caching options and implements the JPA 2. caching API.

http://wiki.eclipse.org/EclipseLink/FAQ/How_to_disable_the_shared_cache%3F