Hi folks,
I need to query several Databases for certain entities. I now stumbled upon the problem that Hibernate does have so called "L1" cache, that is enabled by default and that therefore multiple requests against my datasources return the same Objects although the some properties (row values) have changed.
I cannot control changes to the database since those are performed by another application.
My current setup is on top of Tomcat 6 and Spring 2.5: - 10 ODBC Datasources using the Sun JDBC/ODBC bridge, wrapped by the XAPool of enhydra.org. - The JOTM Transaction Manager - Hibernate as JPA Provider with 10 persitence units configured using Spring.
My question is now: What are the options to disable L1 caching overall for these EntityManagers or for certain Entities? Or how can I programmatically ensure that the data provides is allways fetched from the database. I've read already a little about some possible options, (SessionFactory.evict, EntityManager.clear, ..), but I am after all not sure, which works best and can be implemeted with little effort. If anyone has some suggestions I'd be most gratefull.
greets, Christian
|