Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Cache issue
Cache issue [message #483924] Thu, 03 September 2009 11:47 Go to previous message
Enrico is currently offline Enrico
Messages: 82
Registered: July 2009
Member
Dear all,

I have a problem when I enable the eclipselink cache default one).

All my CRUD (Create, Read, Update and Delete) are implemented
instantiating and closing an EntityManager. For example:

public final T findById(I id) {

EntityManager entityManager = JpaManager.getManager();

try {
return (T) entityManager.find(entityClass, id);
}catch(Exception ex){
....
} finally {
entityManager.close();
}
return null;
}


public final void save(final T object) {

EntityManager entityManager = JpaManager.getManager();

try {
entityManager.getTransaction().begin();

entityManager.persist(object);

entityManager.getTransaction().commit();
}catch(Exception ex){
entityManager.getTransaction().rollback();
......
}finally {
entityManager.close();
}
}


It happens that sometimes I save an object and then I load (e.g.
findBtyId) but the retrieved value in not updated (that is, it is not
the last value I have saved or updated). On the DB, the table contain
the right value (the last saved).


I've tried to disable the cache in the persistence.xml file:

<property name="eclipselink.cache.type.default" value="None"/>

and all is going well.

Any help about?I need to configure the cache differently basing on the
structure of my code?)

BR,
Enrico
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:Is TABLE_PER_CLASS supposed to work with eclipselink-2.0.0.v20090731-r4765 (m6)
Next Topic:TEST POLL: What database do you use?
Goto Forum:
  


Current Time: Tue Jun 18 02:12:23 EDT 2013

Powered by FUDForum. Page generated in 0.02035 seconds