The CacheLoader discussed on the link you posted is not meant to be used with EJB entity
caching. A CacheLoader allows the cache to maintain a persistent form of some or all of
the data the cache is managing. In the case of entity caching, having the cache do this is
redundant; the underlying database from which the entities come is already a persistent
store.
As to why you're still seeing queries, that's hard to say. Some possibilities:
1) The queries are not of the simple 'select record from table where primary_key =
?' type. In that case Hibernate will be executing queries to determine the PK of
entities that match your requirements, and then will either get then entity from the cache
or from the DB. (Note: you can also configure the EntityManager to cache the results of
such queries.)
2) Entities are being evicted from the cache to save memory (it has an eviction policy
configure). If the entity is evicted, the EntityManager will have to go back to the DB.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4034557#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...