Java Code Examples for org.hibernate.type.Type#setToXMLNode()

The following examples show how to use org.hibernate.type.Type#setToXMLNode() . 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
public void initializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner)
throws HibernateException {
	
	Type elementType = persister.getElementType();
	Type indexType = persister.getIndexType();
	final String indexNodeName = getIndexAttributeName(persister);

	Serializable[] cached = (Serializable[]) disassembled;

	for ( int i=0; i<cached.length; ) {
		Object index = indexType.assemble( cached[i++], getSession(), owner );
		Object object = elementType.assemble( cached[i++], getSession(), owner );
		
		Element subelement = element.addElement( persister.getElementNodeName() );
		elementType.setToXMLNode( subelement, object, persister.getFactory() );
		
		String indexString = ( (NullableType) indexType ).toXMLString( index, persister.getFactory() );
		setIndex( subelement, indexNodeName, indexString );
	}
	
}
 
Example 2
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 3
public void initializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner)
throws HibernateException {
	
	Type elementType = persister.getElementType();
	final String indexNodeName = getIndexAttributeName(persister);
	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() );
		setIndex( subelement, indexNodeName, Integer.toString(i) );
	}
	
}
 
Example 4
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 5
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() );
	}
	
}