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

This code example shows how to use the following methods:getFactory, getKeyType, getOwnerEntityPersister, getRole
This code example shows how to use the following methods:getElementNodeName, getElementType, getFactory, getIndexNodeName, getIndexType
			element = owner.element( nodeName ); 
			if (element==null) element = owner.addElement( nodeName ); 
		} 
	} 
 
	public boolean isWrapper(Object collection) { 
		return element==collection; 
	} 
 
	public boolean equalsSnapshot(CollectionPersister persister) throws HibernateException { 
		Type elementType = persister.getElementType(); 
		String indexNode = getIndexAttributeName(persister);		 
		HashMap snapshot = (HashMap) getSnapshot(); 
		List elements = element.elements( persister.getElementNodeName() ); 
		if ( snapshot.size()!= elements.size() ) return false; 
		for ( int i=0; i<snapshot.size(); i++ ) { 
			Element elem = (Element) elements.get(i); 
			Object old = snapshot.get( getIndex(elem, indexNode, i) ); 
			Object current = elementType.fromXMLNode( elem, persister.getFactory() ); 
			if ( elementType.isDirty( old, current, getSession() ) ) return false; 

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getElementColumnAliases, getIdentifierColumnAlias, getIndexColumnAliases, getKeyColumnAliases
		this.suffix = suffix;
		this.userProvidedAliases = userProvidedAliases;
 
		this.keyAliases = getUserProvidedAliases(
				"key",  
				persister.getKeyColumnAliases( suffix )
			); 
 
		this.indexAliases = getUserProvidedAliases(
				"index", 
				persister.getIndexColumnAliases( suffix )
				); 
		 
		this.elementAliases = getUserProvidedAliases( "element", 
				persister.getElementColumnAliases( suffix )
				); 
				 
		this.identifierAlias = getUserProvidedAlias( "id", 
				persister.getIdentifierColumnAlias( suffix )
				); 

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getCollectionType, getElementType, hasIndex, isOneToMany, getElementColumnNames
	private void prepareForIndex(QueryTranslatorImpl q) throws QueryException {
 
		QueryableCollection collPersister = q.getCollectionPersister( collectionRole );
 
		if ( !collPersister.hasIndex() ) throw new QueryException( "unindexed collection before []: " + path );
		String[] indexCols = collPersister.getIndexColumnNames();
		if ( indexCols.length != 1 ) throw new QueryException( "composite-index appears in []: " + path );
		//String[] keyCols = collPersister.getKeyColumnNames(); 
 
		JoinSequence fromJoins = new JoinSequence( q.getFactory() )
				.setUseThetaStyle( useThetaStyleJoin )
				.setRoot( collPersister, collectionName )
				.setNext( joinSequence.copy() );
 
		if ( !continuation ) addJoin( collectionName, collPersister.getCollectionType() );
 
		joinSequence.addCondition( collectionName + '.' + indexCols[0] + " = " ); //TODO: get SQL rendering out of here
 
		CollectionElement elem = new CollectionElement();
		elem.elementColumns = collPersister.getElementColumnNames(collectionName);

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getElementNodeName, getElementType, getFactory, readElement
	public void initializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner) 
	throws HibernateException { 
 
		Type elementType = persister.getElementType(); 
		Serializable[] cached = (Serializable[]) disassembled; 
		for ( int i=0; i<cached.length; i++ ) { 
			Object object = elementType.assemble( cached[i], getSession(), owner ); 
			Element subelement = element.addElement( persister.getElementNodeName() ); 
			elementType.setToXMLNode( subelement, object, persister.getFactory() ); 
		} 
 
	} 
 
	public Serializable disassemble(CollectionPersister persister) throws HibernateException { 
 
		Type elementType = persister.getElementType(); 
		List elements =  element.elements( persister.getElementNodeName() ); 
		int length = elements.size(); 
		Serializable[] result = new Serializable[length]; 
		for ( int i=0; i<length; i++ ) { 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getCollectionType, getOwnerEntityPersister, getRole
				if ( isOwnerUnchanged( persistentCollection, persister, extractCollectionKeyFromOwner( persister ) ) ) {
					// a "detached" collection that originally belonged to the same entity 
					if ( persistentCollection.isDirty() ) {
						throw new HibernateException( "reassociated object has dirty collection" );
					} 
					reattachCollection( persistentCollection, type );
				} 
				else { 
					// a "detached" collection that belonged to a different entity 
					throw new HibernateException( "reassociated object has dirty collection reference" );
				} 
			} 
			else { 
				// a collection loaded in the current session 
				// can not possibly be the collection belonging 
				// to the entity passed to update() 
				throw new HibernateException( "reassociated object has dirty collection reference" );
			} 
		} 
		else { 

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getCollectionType, getOwnerEntityPersister
        if ( role.getCollectionType().useLHSPrimaryKey() ) { 
			return ownerIdentifier; 
		} 
        return (Serializable)role.getOwnerEntityPersister().getPropertyValue( 
				owner, 
				role.getCollectionType().getLHSPropertyName() 
		); 
	} 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getCollectionType, getOwnerEntityPersister, getRole
 
		final Serializable collectionKey = extractCollectionKeyFromOwner( persister );
		if ( collection!=null && (collection instanceof PersistentCollection) ) {
			PersistentCollection wrapper = (PersistentCollection) collection;
			if ( wrapper.setCurrentSession(session) ) {
				//a "detached" collection! 
				if ( !isOwnerUnchanged( wrapper, persister, collectionKey ) ) {
					// if the collection belonged to a different entity, 
					// clean up the existing state of the collection 
					removeCollection( persister, collectionKey, session );
				} 
				reattachCollection(wrapper, type);
			} 
			else { 
				// a collection loaded in the current session 
				// can not possibly be the collection belonging 
				// to the entity passed to update() 
				removeCollection(persister, collectionKey, session);
			} 
		} 

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getOwnerEntityPersister, getRole, hasOrphanDelete
							loadedPersister, 
							entry.getLoadedKey(), 
							session.getFactory() 
					) 
			); 
		} 
 
		// do a check 
		boolean hasOrphanDelete = loadedPersister != null && loadedPersister.hasOrphanDelete(); 
		if (hasOrphanDelete) { 
			Serializable ownerId = loadedPersister.getOwnerEntityPersister().getIdentifier( coll.getOwner(), session ); 
			if ( ownerId == null ) { 
				// the owning entity may have been deleted and its identifier unset due to 
				// identifier-rollback; in which case, try to look up its identifier from 
				// the persistence context 
				if ( session.getFactory().getSettings().isIdentifierRollbackEnabled() ) { 
					EntityEntry ownerEntry = persistenceContext.getEntry( coll.getOwner() ); 
					if ( ownerEntry != null ) { 
						ownerId = ownerEntry.getId(); 
					} 

5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getOwnerEntityPersister
See Code Examples for Hibernate ORM CollectionPersister Methods: