Hibernate version:2.1.7c
Name and version of the database you are using: MySQL 4.1
I have the following problem: I have 2 different Webapplications deployed on a Tomcat server which both write into the same DB.
When one application writes into the DB, the other sees the change about an hour later (or so .... but not immediatly). I also noted that the same thing occurs if I change data using the MySQL Control Center.
Is there a way to be sure that the data is retrieved from the db and not the cache?
Here is a sniplet of what I am doing
Code:
session = sessionFactory.openSession();
tx = session.beginTransaction();
Criteria crit = session.createCriteria( Duh.class );
crit.add( Expression.eq( Duh.PROP_Duh, "XXXX" );
crit.setLockMode(LockMode.READ);
li = crit.list();
tx.commit();
session.close();
Note that I used the LockMode.Read for the query. The Hibernate in Action document states :
Quote:
Bypass both levels of cache and perform a version check to verify that the object in memory is the same version that currently exists in the database
.
Am I doing something wrong (I don't have any versioning in my db objects so the lockmode might be false)?