Hibernate ORM CollectionType - 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 CollectionType class.

This code example shows how to use the following methods: getRole, hasHolder, wrap
	final Object processArrayOrNewCollection(Object collection, CollectionType collectionType) 
	throws HibernateException { 
 
		final SessionImplementor session = getSession(); 
 
		if (collection==null) { 
			//do nothing 
			return null; 
		} 
		else { 
			CollectionPersister persister = session.getFactory().getCollectionPersister( collectionType.getRole() ); 
 
			final PersistenceContext persistenceContext = session.getPersistenceContext(); 
			//TODO: move into collection type, so we can use polymorphism! 
			if ( collectionType.hasHolder() ) { 
 
				if (collection==CollectionType.UNFETCHED_COLLECTION) return null; 
 
				PersistentCollection ah = persistenceContext.getCollectionHolder(collection); 
				if (ah==null) { 

6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getRole, hasHolder
			return null; 
		} 
 
		if (collection!=null) { 
			final PersistentCollection coll;
			if ( type.hasHolder() ) {
				coll = getSession().getPersistenceContext().getCollectionHolder(collection);
			} 
			else { 
				coll = (PersistentCollection) collection;
			} 
 
			Collections.processReachableCollection( coll, type, owner, getSession() );
		} 
 
		return null; 
 
	} 
 
	FlushVisitor(EventSource session, Object owner) {

5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getRole
		try { 
			return ( QueryableCollection ) factory.getCollectionPersister( role );
		} 
		catch ( ClassCastException cce ) {
			throw new QueryException( "collection role is not queryable: " + role );
		} 
		catch ( Exception e ) {
			throw new QueryException( "collection role not found: " + role );
		} 
	} 
 
	public final TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery)
	        throws HibernateException {
		return NO_VALUES;
	} 
 
	public final String toString() {
		return propertyName + ( excludeEmpty() ? " is not empty" : " is empty" );
	} 
} 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getRole
	 * wrapper 
	 */ 
	protected void reattachCollection(PersistentCollection collection, CollectionType type)
	throws HibernateException {
		if ( collection.wasInitialized() ) {
			CollectionPersister collectionPersister = getSession().getFactory()
			.getCollectionPersister( type.getRole() );
			getSession().getPersistenceContext()
				.addInitializedDetachedCollection( collectionPersister, collection );
		} 
		else { 
			if ( !isCollectionSnapshotValid(collection) ) {
				throw new HibernateException( "could not reassociate uninitialized transient collection" );
			} 
			CollectionPersister collectionPersister = getSession().getFactory()
					.getCollectionPersister( collection.getRole() );
			getSession().getPersistenceContext()
				.addUninitializedDetachedCollection( collectionPersister, collection );
		} 
	} 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: hasHolder
		return null; 
	} 
	public void evictCollection(Object value, CollectionType type) { 
 
		final Object pc; 
		if ( type.hasHolder() ) { 
			pc = getSession().getPersistenceContext().removeCollectionHolder(value); 
		} 
		else if ( value instanceof PersistentCollection ) { 
			pc = value; 
		} 
		else { 
			return; //EARLY EXIT! 
		} 
 
		PersistentCollection collection = (PersistentCollection) pc; 
		if ( collection.unsetSession( getSession() ) ) evictCollection(collection); 
	} 
 
	private void evictCollection(PersistentCollection collection) { 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
See Code Examples for Hibernate ORM CollectionType Methods: