openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frederic_Bell...@capgroup.com
Subject EntitymanagerFactoryImpl.getStoreCache(String cacheName) problem
Date Thu, 03 Apr 2008 17:44:17 GMT

The EntitymanagerFactoryImpl.getStoreCache(String cacheName) . This method
calls DataCacheManager.getDataCache(cacheName).
I think it should call DataCachemanager.getDataCache(cacheName, true) to
make sure if the cache does not exist it will get created. Unless of course
this is the behavior specified by JPA spec. This is important becuase
otherwise we get StoreCacheImpl reference with a DelegatingDataCache
reference with a null cache reference inside.

An alternative to make this work would be to instanciate all the namedCache
at startup - but this does not sound like a good idea to me because noone
can know upfront whcih cache will actually be used. The current
DataCacheManagerImpl does not suffer from this issue becuase there is only
one dataCache.
But in the case of a DataCacheManager implementation with multiple named
cache - which is what I am implementing now - then this does not work
anymore.
Moreover, I cannot chnage the behavior of getDataCache(String name) becuase
the interface says:
    /**
     * Return the named data cache, or null if it does not exist.
     */
    public DataCache getDataCache(String name);


Could this code change be made in the future?

F


Mime
View raw message