KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > action > CollectionRecreateAction


1 //$Id: CollectionRecreateAction.java,v 1.7 2005/06/15 13:20:08 oneovthafew Exp $
2
package org.hibernate.action;
3
4 import org.hibernate.HibernateException;
5 import org.hibernate.cache.CacheException;
6 import org.hibernate.collection.PersistentCollection;
7 import org.hibernate.engine.SessionImplementor;
8 import org.hibernate.persister.collection.CollectionPersister;
9
10 import java.io.Serializable JavaDoc;
11
12 public final class CollectionRecreateAction extends CollectionAction {
13
14     public CollectionRecreateAction(
15                 final PersistentCollection collection,
16                 final CollectionPersister persister,
17                 final Serializable JavaDoc id,
18                 final SessionImplementor session)
19             throws CacheException {
20         super( persister, collection, id, session );
21     }
22
23     public void execute() throws HibernateException {
24         final PersistentCollection collection = getCollection();
25         
26         getPersister().recreate( collection, getKey(), getSession() );
27         
28         getSession().getPersistenceContext()
29                 .getCollectionEntry(collection)
30                 .afterAction(collection);
31         
32         evict();
33
34         if ( getSession().getFactory().getStatistics().isStatisticsEnabled() ) {
35             getSession().getFactory().getStatisticsImplementor()
36                     .recreateCollection( getPersister().getRole() );
37         }
38     }
39
40 }
41
42
43
44
45
46
47
48
Popular Tags