Hibernate ORM PersistentCollection - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM PersistentCollection class.

This code example shows how to use the following methods:clearDirty, dirty, wasInitialized
	} 
 
	@SuppressWarnings("unchecked") 
	public void decode(ExtendedObjectInput in, Object v) throws IOException, ClassNotFoundException, IllegalAccessException {
		PersistentCollection collection = (PersistentCollection)v;
		if (collection.wasInitialized()) {
			boolean sorted = (collection instanceof SortedSet || collection instanceof SortedMap);
			PersistentCollectionSnapshot snapshot = new JMFPersistentCollectionSnapshot(sorted, null);
			snapshot.readCoreData(in);
			 
			if (collection instanceof Map)
				((Map<Object, Object>)collection).putAll(snapshot.getElementsAsMap());
			else 
				((Collection<Object>)collection).addAll(snapshot.getElementsAsCollection());
 
			if (snapshot.isDirty())
				collection.dirty();
			else 
				collection.clearDirty();
		} 

6
CodeRank
This code example shows how to use the following methods:clearDirty, getSnapshot, setSnapshot
 * @author Steve Ebersole 
 */ 
public class StatefulPersistenceContext implements PersistenceContext { 
 
	public static final Object NO_ROW = new MarkerObject( "NO_ROW" ); 
 
    private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, 
                                                                       StatefulPersistenceContext.class.getName()); 
	private static final int INIT_COLL_SIZE = 8; 
 
	private SessionImplementor session; 
 
	// Loaded entity instances, by EntityKey 
	private Map entitiesByKey; 
 
	// Loaded entity instances, by EntityUniqueKey 
	private Map entitiesByUniqueKey; 
 
	// Identity map of EntityEntry instances, by the entity instance 
	private Map entityEntries; 
3
CodeRank
See Code Examples for Hibernate ORM PersistentCollection Methods: