Hibernate 2e cache de niveau

Salut, j'ai certains problèmes avec hibernate 2ème niveau de cache.
En tant que fournisseur de cache-je utiliser ehcache.

Partie de la config à partir de persistence.xml

<property name="hibernate.cache.use_second_level_cache" value="true"/>
<property name="hibernate.cache.provider_class" value="net.sf.ehcache.hibernate.EhCacheProvider" />
<property name="hibernate.cache.provider_configuration_file_resource_path" value="/ehcache.xml" />

- Je configurer mon entités à l'aide d'annotations donc:

@Cache(région = "Kierunek", usage = CacheConcurrencyStrategy.READ_WRITE) 
public class Kierunek implémente Serializable {

les importations de ces annotations sont:
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

mon ehcache.xml

<diskStore path="java.io.tmpdir" />

<defaultCache maxElementsInMemory="10000" eternal="false"
    timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="true"
    diskSpoolBufferSizeMB="30" maxElementsOnDisk="10000000"
    diskPersistent="false" diskExpiryThreadIntervalSeconds="120"
    memoryStoreEvictionPolicy="LRU" />

<cache name="Kierunek" maxElementsInMemory="1000"
    eternal="true" overflowToDisk="false" memoryStoreEvictionPolicy="LRU" />

Et toute idée de pourquoi je reçois d'erreur suivant ?

WARNING: Could not find a specific ehcache configuration for cache named [persistence.unit:unitName=pz2EAR.ear/pz2EJB.jar#pz2EJB.Kierunek]; using defaults.
19:52:57,313 ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=pz2EAR.ear/pz2EJB.jar#pz2EJB state=Create
java.lang.IllegalArgumentException: Cache name cannot contain '/' characters.

solution est d'ajouter une autre propriété persistence.xml

<property name="hibernate.cache.region_prefix" value=""/>

et qui supprime défaut du préfixe big thx ruslan!

Vous devriez entièrement épeler le mot "niveau" au lieu de "lvl". C'est plus lisible et seachable.
Vous êtes de droite. J'ai écrit cet être plutôt frustré, alors je n'avais pas pensé ^^ merci

OriginalL'auteur Dogrizz | 2009-04-19