persitence.xml
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.SingletonEhCacheProvider"/>
<property name="hibernate.ejb.classcache.demo.entities.UserID" value="read-only"/>
<property name="javax.persistence.sharedCache.mode" value="ALL"/>
ehcache.xml에게 다음과 같이 내 구성은
<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd" updateCheck="false">
<diskStore path="java.io.tmpdir/Customer-portlet-cache"/>
<defaultCache eternal="false" maxElementsInMemory="1000"
overflowToDisk="false" diskPersistent="false" timeToIdleSeconds="0"
timeToLiveSeconds="600" memoryStoreEvictionPolicy="LRU"/>
<cache name="userCache" eternal="true"
maxElementsInMemory="999" overflowToDisk="true"
diskPersistent="true" timeToIdleSeconds="0"
timeToLiveSeconds="300" memoryStoreEvictionPolicy="LRU"/>
</ehcache>
나는 심 구성 요소 @Create을 주석이 모든 UserID에 대한 목록을 가져 와서 캐시에 저장합니다. 여기서 아이디어는 웜 캐시로 애플리케이션을 얻는 것입니다.하지만 애플리케이션에서 엔티티에 액세스 할 때 Lazy 초기화 예외가 발생하기 시작합니다 (엔티티가 persistenceContext와 연결되어 있지 않고 OneToMany 및 ManyToMany 관계를 가지고 있기 때문에 엔티티가로드되지 않을 것이고 fetchtype을 eager로 설정하면 열악한 영역이 표시됨)
사용자가 응용 프로그램에 액세스 할 때 웜 캐시를 가져 오는 방법이나 해결 방법이 있습니까?
예 singletonehcachefactory가 수정되어야합니다. Thatnks that :-) – user10398