@SuppressWarnings({"unchecked", "UnusedParameters"}) protected Serializable snapshot(BasicCollectionPersister persister, EntityMode entityMode) throws HibernateException { final TreeMap clonedSet = new TreeMap( comparator ); for ( Object setElement : set ) { final Object copy = persister.getElementType().deepCopy( setElement, persister.getFactory() ); clonedSet.put( copy, copy ); } return clonedSet; }
@SuppressWarnings({"unchecked", "UnusedParameters"}) protected Serializable snapshot(BasicCollectionPersister persister, EntityMode entityMode) throws HibernateException { final TreeMap clonedMap = new TreeMap( comparator ); for ( Object o : map.entrySet() ) { final Entry e = (Entry) o; clonedMap.put( e.getKey(), persister.getElementType().deepCopy( e.getValue(), persister.getFactory() ) ); } return clonedMap; }
public static CollectionPersister createCollectionPersister(Configuration cfg, Collection model, CacheConcurrencyStrategy cache, SessionFactoryImplementor factory) throws HibernateException { Class persisterClass = model.getCollectionPersisterClass(); if(persisterClass==null) { // default behavior return model.isOneToMany() ? (CollectionPersister) new OneToManyPersister(model, cache, cfg, factory) : (CollectionPersister) new BasicCollectionPersister(model, cache, cfg, factory); } else { return create(persisterClass, cfg, model, cache, factory); } }
protected Serializable snapshot(BasicCollectionPersister persister, EntityMode entityMode) throws HibernateException { //if (set==null) return new Set(session); TreeMap clonedSet = new TreeMap(comparator); Iterator iter = set.iterator(); while ( iter.hasNext() ) { Object copy = persister.getElementType().deepCopy( iter.next(), entityMode, persister.getFactory() ); clonedSet.put(copy, copy); } return clonedSet; }
protected Serializable snapshot(BasicCollectionPersister persister, EntityMode entityMode) throws HibernateException { TreeMap clonedMap = new TreeMap(comparator); Iterator iter = map.entrySet().iterator(); while ( iter.hasNext() ) { Map.Entry e = (Map.Entry) iter.next(); clonedMap.put( e.getKey(), persister.getElementType().deepCopy( e.getValue(), entityMode, persister.getFactory() ) ); } return clonedMap; }
private Class<BasicCollectionPersister> basicCollectionPersister() { return BasicCollectionPersister.class; }