-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Enable second level cache on many to many bi-directional
PostPosted: Mon Jul 18, 2016 10:30 am 
Newbie

Joined: Mon Jul 18, 2016 4:53 am
Posts: 3
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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.