-->
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.  [ 2 posts ] 
Author Message
 Post subject: Does evict() method, evict child objects?
PostPosted: Thu Sep 15, 2005 8:55 am 
Regular
Regular

Joined: Wed Jul 27, 2005 2:33 am
Posts: 118
I have a object which has second level cache enabled. This class has a 'Set' of child objects which also have second level cache enabled.
Now, if i issue a evict() on the parent object, will the child objects also be evicted from cache?
Following is the hbm mappings:

Code:

<class
    name="com.abc.parent"
    table="Parent"
>
[b]<cache usage="transactional"/>[/b]
   <composite-id name="id" class="com.abc.parentId">
        <key-property
            name="id"
            column="PARENT_ID"
           
        >
        </key-property>
        <key-property
            name="versionId"
            column="PARENT_VERSION_ID"
           
        >
        </key-property>
       
    </composite-id>   

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

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

       </set>


Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 15, 2005 9:15 am 
Regular
Regular

Joined: Wed Jul 27, 2005 2:33 am
Posts: 118
Got the answer from the Hibernate reference document:

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


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

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.