javaglassfishejbinit

Initializes a previous state from the DB


There is this one application I'm working on and it has a "wierd" problem I'm not ablet to figure out. I have some Data in the DB, and the problem is, when I login into the application, I always get only the state of Data from the DB when the Server was started - not the new data. Everything writen into the DB after the start won't appear. When I restart the server, it's there, but again the new Data won't appear. The data is needed in the homepage of the application, so this Init() method is executed during the login process. If I manually delete some Data from the DB, I can still see them in the application. It's like some kind of cache that produces this problem...

It's a Java EE application, running on a Glasfish server, using Apache web server, Oracle DB and Solr.

Anyways, the Init method looks something like this:

private MyClass mc;
private List<MyData> myList;

@Override
@PostConstruct
public void initDefaults() {
    myList= mc.getDataList();       
}

In MyClass:

public List<MyData> fetchAllData(){
    return this.em.createNamedQuery(someClass.FINDALL).getResultList();
}

I don't think that this is a Problem related to the code, it works fine in a other part of the application. Could it be some setting? Any expirience?


Solution

  • The @Cacheable(false) annotation in the Business Entity class solved the problem..