Java Code Examples for org.hibernate.persister.collection.CollectionPersister#readElement()

The following examples show how to use org.hibernate.persister.collection.CollectionPersister#readElement() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public Object readFrom(
		ResultSet rs,
		CollectionPersister persister,
		CollectionAliases descriptor,
		Object owner) throws HibernateException, SQLException {
	final Object element = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() );
	final Object old = identifiers.put(
		values.size(),
		persister.readIdentifier( rs, descriptor.getSuffixedIdentifierAlias(), getSession() )
	);

	if ( old == null ) {
		//maintain correct duplication if loaded in a cartesian product
		values.add( element );
	}
	return element;
}
 
Example 2
Source Project: lams   File: PersistentMap.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public Object readFrom(
		ResultSet rs,
		CollectionPersister persister,
		CollectionAliases descriptor,
		Object owner) throws HibernateException, SQLException {
	final Object element = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() );
	if ( element != null ) {
		final Object index = persister.readIndex( rs, descriptor.getSuffixedIndexAliases(), getSession() );
		if ( loadingEntries == null ) {
			loadingEntries = new ArrayList<>();
		}
		loadingEntries.add( new Object[] { index, element } );
	}
	return element;
}
 
Example 3
public Object readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner)
throws HibernateException, SQLException {
	Object object = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() );
	final Type elementType = persister.getElementType();
	final SessionFactoryImplementor factory = persister.getFactory();
	String indexNode = getIndexAttributeName(persister);

	Element elem = element.addElement( persister.getElementNodeName() );
	elementType.setToXMLNode( elem, object, factory ); 
	
	final Type indexType = persister.getIndexType();
	final Object indexValue = persister.readIndex( rs, descriptor.getSuffixedIndexAliases(), getSession() );
	final String index = ( (NullableType) indexType ).toXMLString( indexValue, factory );
	setIndex(elem, indexNode, index);
	return object;
}
 
Example 4
@Override
@SuppressWarnings("unchecked")
public Object readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner)
		throws HibernateException, SQLException {
	final Object element = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() ) ;
	final int index = (Integer) persister.readIndex( rs, descriptor.getSuffixedIndexAliases(), getSession() );

	//pad with nulls from the current last element up to the new index
	for ( int i = list.size(); i<=index; i++) {
		list.add( i, null );
	}

	list.set( index, element );
	return element;
}
 
Example 5
Source Project: lams   File: PersistentBag.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public Object readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner)
		throws HibernateException, SQLException {
	// note that if we load this collection from a cartesian product
	// the multiplicity would be broken ... so use an idbag instead
	final Object element = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() ) ;
	if ( element != null ) {
		bag.add( element );
	}
	return element;
}
 
Example 6
@Override
@SuppressWarnings("unchecked")
public Object readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner)
throws HibernateException, SQLException {
	final Object element = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() );
	final int index = (Integer) persister.readIndex( rs, descriptor.getSuffixedIndexAliases(), getSession() );
	for ( int i = tempList.size(); i<=index; i++) {
		tempList.add( i, null );
	}
	tempList.set( index, element );
	return element;
}
 
Example 7
Source Project: lams   File: PersistentSet.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public Object readFrom(
		ResultSet rs,
		CollectionPersister persister,
		CollectionAliases descriptor,
		Object owner) throws HibernateException, SQLException {
	final Object element = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() );
	if ( element != null ) {
		tempList.add( element );
	}
	return element;
}
 
Example 8
public Object readFrom(
	ResultSet rs,
	CollectionPersister persister,
	CollectionAliases descriptor,
	Object owner)
	throws HibernateException, SQLException {

	Object element = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() );
	Object old = identifiers.put(
		new Integer( values.size() ),
		persister.readIdentifier( rs, descriptor.getSuffixedIdentifierAlias(), getSession() )
	);
	if ( old==null ) values.add(element); //maintain correct duplication if loaded in a cartesian product
	return element;
}
 
Example 9
public Object readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner) 
throws HibernateException, SQLException {
	Object element = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() ) ;
	int index = ( (Integer) persister.readIndex( rs, descriptor.getSuffixedIndexAliases(), getSession() ) ).intValue();
	
	//pad with nulls from the current last element up to the new index
	for ( int i = list.size(); i<=index; i++) {
		list.add(i, null);
	}
	
	list.set(index, element);
	return element;
}
 
Example 10
public Object readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner)
throws HibernateException, SQLException {
	// note that if we load this collection from a cartesian product
	// the multiplicity would be broken ... so use an idbag instead
	Object element = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() ) ;
	if (element!=null) bag.add(element);
	return element;
}
 
Example 11
public Object readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner)
throws HibernateException, SQLException {
	Object element = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() );
	Object index = persister.readIndex( rs, descriptor.getSuffixedIndexAliases(), getSession() );
	if ( element!=null ) map.put(index, element);
	return element;
}
 
Example 12
public Object readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner)
throws HibernateException, SQLException {
	Object object = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() );
	final Type elementType = persister.getElementType();
	Element subelement = element.addElement( persister.getElementNodeName() );
	elementType.setToXMLNode( subelement, object, persister.getFactory() ); 
	return object;
}
 
Example 13
public Object readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner)
throws HibernateException, SQLException {

	Object element = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() );
	int index = ( (Integer) persister.readIndex( rs, descriptor.getSuffixedIndexAliases(), getSession() ) ).intValue();
	for ( int i = tempList.size(); i<=index; i++) {
		tempList.add(i, null);
	}
	tempList.set(index, element);
	return element;
}
 
Example 14
public Object readFrom(
        ResultSet rs,
        CollectionPersister persister,
        CollectionAliases descriptor,
        Object owner) throws HibernateException, SQLException {
	Object element = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() );
	if (element!=null) tempList.add(element);
	return element;
}