Hi,
We have 2 entities one is called Link and the second one is LinkTerminationPoint and the relation is bi-directional many to many. We tried to add the cache annotation to the Link and LinkTerminationpoint and the server has come up, but when we are trying to put cache annotation on the many to many relation it doesn't work and the server doesn't come up.
Below is my configuration:
This Link class hbm:
<class name="com.cisco.xmp.model.foundation.encapsulatedFunctionality.Link" discriminator-value="Link" table="Link"> <cache usage="read-write" region="com.cisco.xmp.model.foundation.encapsulatedFunctionality.Link"></cache> <id name="instanceId" column="ID" type="long" unsaved-value="0" access="property"> ..... </component> <set name="linkTerminationPoints" table="DependantLinkRelatesLTPs" cascade="save-update" inverse="true"> <key> <column name="DependantLinks_ID" index="DependantLinks_IDX"/> </key> <cache usage="read-write" region="com.cisco.xmp.model.foundation.encapsulatedFunctionality.Link"></cache> <many-to-many column="LinkTerminationPoints_ID" class="com.cisco.xmp.model.foundation.encapsulatedFunctionality.LinkTerminationPoint"/> </set>
This is LinkTerminationpoint hbm:
<class name="com.cisco.xmp.model.foundation.encapsulatedFunctionality.LinkTerminationPoint" discriminator-value="LinkTerminationPoint" table="LinkTerminationPoint"> <cache usage="read-write" region="com.cisco.xmp.model.foundation.encapsulatedFunctionality.Link"></cache> <id name="instanceId" column="ID" type="long" unsaved-value="0" access="property">
.....
<set name="dependantLinks" table="DependantLinkRelatesLTPs" cascade="save-update"> <key> <column name="LinkTerminationPoints_ID"/> </key> <cache usage="read-write" region="com.cisco.xmp.model.foundation.encapsulatedFunctionality.Link"></cache> <many-to-many column="DependantLinks_ID" class="com.cisco.xmp.model.foundation.encapsulatedFunctionality.Link"/> </set>
Second level cache configuration:
hibernate.cache.region.factory_class=net.sf.ehcache.hibernate.EhCacheRegionFactory hibernate.cache.use_second_level_cache=true hibernate.cache.use_query_cache=true
ehcache.xml:
<?xml version="1.0" encoding="UTF-8"?> <ehcache name="liel-cache" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true" monitoring="autodetect" dynamicConfig="true">
<diskStore path="java.io.tmpdir/ehcache" />
<defaultCache maxEntriesLocalHeap="10000" eternal="false" timeToIdleSeconds="120" timeToLiveSeconds="120" diskSpoolBufferSizeMB="30" maxEntriesLocalDisk="10000000" diskExpiryThreadIntervalSeconds="120" memoryStoreEvictionPolicy="LRU" statistics="true"> <persistence strategy="localTempSwap" /> </defaultCache>
<cache name="com.cisco.xmp.model.foundation.encapsulatedFunctionality.Link" maxEntriesLocalHeap="10000" eternal="false" timeToIdleSeconds="5" timeToLiveSeconds="10"> <persistence strategy="localTempSwap" /> </cache>
<cache name="org.hibernate.cache.internal.StandardQueryCache" maxEntriesLocalHeap="5" eternal="false" timeToLiveSeconds="120"> <persistence strategy="localTempSwap" /> </cache>
<cache name="org.hibernate.cache.spi.UpdateTimestampsCache" maxEntriesLocalHeap="5000" eternal="true"> <persistence strategy="localTempSwap" /> </cache> </ehcache>
Am I miss something in my hbm configuration?
|