-->
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: Evicting a collection from hibernate second level cache
PostPosted: Tue Oct 11, 2005 4:35 am 
Regular
Regular

Joined: Wed Jul 27, 2005 2:33 am
Posts: 118
Hi,
I have a hibernate object containing a collection(set) of child objects. Both the object and the collection are cached(second-level cache). I would like to evict the object as well as its collection from cache.

I tried out the evict() method on the object but it did NOT evict the collection. It only evicted the parent object. I have cascade="all-delete-orphan" on the collection. Is this the expected behaviour? I however had read the following in Hibernate documentation:

Quote:
Hibernate will evict associated entities automatically if the association is mapped with cascade="all" or cascade="
all-delete-orphan".


Now, suppose i use the evictCollection(String roleName) method to evict the collection. What should the 'roleName' that i should pass to this method? I have the following hbm:

Code:
<hibernate-mapping>

<class
    name=[b]"com.abc.Parent"[/b]
    table="CR_PROCESSING_ENGINE"
    discriminator-value="-1"
>
[b]<cache usage="transactional"/>[/b]
    <composite-id name="id" class="com.abc.ParentId">
        <key-property
            name="id"
            column="ID"
           
        >
        </key-property>
        <key-property
            name="versionId"
            column="VERSION_ID"
           
        >
        </key-property>
       
    </composite-id>

<set
            name=[b]"children"[/b]
            lazy="false"
            inverse="true"
            [b]cascade="all-delete-orphan"[/b]
       >
   [b]<cache usage="transactional"/>[/b]
       <key
       >
       <column
            name="ID"
       />
       <column
            name="VERSION_ID"
       />
       </key>

       <one-to-many
          class="com.abc.Child"
       />

       </set>
</hibernate-mapping>


Thank you.


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.