1 package org.hibernate.type; 3 4 import java.io.Serializable ; 5 import java.util.ArrayList ; 6 7 import org.hibernate.HibernateException; 8 import org.hibernate.collection.PersistentIdentifierBag; 9 import org.hibernate.collection.PersistentCollection; 10 import org.hibernate.engine.SessionImplementor; 11 import org.hibernate.persister.collection.CollectionPersister; 12 13 public class IdentifierBagType extends CollectionType { 14 15 public IdentifierBagType(String role, String propertyRef, boolean isEmbeddedInXML) { 16 super(role, propertyRef, isEmbeddedInXML); 17 } 18 19 public PersistentCollection instantiate( 20 SessionImplementor session, 21 CollectionPersister persister, Serializable key) 22 throws HibernateException { 23 24 return new PersistentIdentifierBag(session); 25 } 26 27 public Object instantiate(Object original) { 28 return new ArrayList (); 29 } 30 31 public Class getReturnedClass() { 32 return java.util.Collection .class; 33 } 34 35 public PersistentCollection wrap(SessionImplementor session, Object collection) { 36 return new PersistentIdentifierBag( session, (java.util.Collection ) collection ); 37 } 38 39 } 40 41 42 43 44 45 46 | Popular Tags |