1 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 ; 11 12 public final class CollectionRecreateAction extends CollectionAction { 13 14 public CollectionRecreateAction( 15 final PersistentCollection collection, 16 final CollectionPersister persister, 17 final Serializable 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 |