To make it clear and easy, I have two projects: 1. An Entity project where there are all the entity classes in this project. 2. An project that contains a main() function to run the application, My ehcache.xml is placed in the class path of this project.
My problem is: I can change the defaultCache element of ehcache.xml and I can see changes from the SQL log file. But I think the Hibernate only read my defaultCache element, because whatever I change in the cache element of a specific entity of ehcache.xml, there won't be any changes in the SQL log.
For example: If I set the maxElementsInMemory of defaultCache element to 0, whatever I set the maxElementsInMemory of the cache element of a entity to 100 or 0, there won't be any that entity cached in the second level cache. If I set the maxElementsInMemory of defaultCache element to 100, whatever I set the maxElementsInMemory of the cache element of a entity to 100 or 0, there are always be that entity cached in the second level cache.
So I think maybe the name attribute of the cache element of a entity is wrongly set and cannot be read from Hibernate?