I have the same issue. I have legacy application that updates a mysql database and a web based hibernate application that renders the rows in the database. My hibernate application is not able to retrieve the rows inserted by the legacy application.
1) I am clearing the session cache by using session.clear() before executing the query
Code:
Query query=null;
DAO= new ConnectionPoolDAO();
Session session=DAO.getSession();
System.out.println("Clearing session cache");
session.clear();
query = session.createQuery("from ConnectionPool");
System.out.println("Querying ConnectionPools");
2) Turned off secondary and query cache
Code:
<property name="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<property name="hibernate.cache.use_second_level_cache">false</property>
<property name="hibernate.cache.use_query_cache" >false</property>
3) The JSp page displaying the result does not cache any thing
Code:
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
What am i missing out here.
However if i insert a row through the hibernate application subsequent queries return new rows inserted.
Any help will be greatly appreciated.