Java Code Examples for org.hibernate.type.Type.assemble()

The following are Jave code examples for showing how to use assemble() of the org.hibernate.type.Type class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: lams   File: PersistentMapElementHolder.java   View Source Code Vote up 6 votes
@Override
@SuppressWarnings("unchecked")
public void initializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner) {
	final Type elementType = persister.getElementType();
	final Type indexType = persister.getIndexType();
	final String indexNodeName = getIndexAttributeName( persister );

	final Serializable[] cached = (Serializable[]) disassembled;
	int i = 0;
	while ( i < cached.length ) {
		final Object index = indexType.assemble( cached[i++], getSession(), owner );
		final Object object = elementType.assemble( cached[i++], getSession(), owner );

		final Element subElement = element.addElement( persister.getElementNodeName() );
		elementType.setToXMLNode( subElement, object, persister.getFactory() );

		final String indexString = ( (XmlRepresentableType) indexType ).toXMLString( index, persister.getFactory() );
		setIndex( subElement, indexNodeName, indexString );
	}
}
 
Example 2
Project: lams   File: PersistentListElementHolder.java   View Source Code Vote up 5 votes
@Override
@SuppressWarnings("deprecation")
public void initializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner)
		throws HibernateException {
	final Type elementType = persister.getElementType();
	final String indexNodeName = getIndexAttributeName( persister );
	final Serializable[] cached = (Serializable[]) disassembled;
	for ( int i=0; i<cached.length; i++ ) {
		final Object object = elementType.assemble( cached[i], getSession(), owner );
		final Element subelement = element.addElement( persister.getElementNodeName() );
		elementType.setToXMLNode( subelement, object, persister.getFactory() );
		setIndex( subelement, indexNodeName, Integer.toString( i ) );
	}
}
 
Example 3
Project: lams   File: PersistentElementHolder.java   View Source Code Vote up 5 votes
@Override
@SuppressWarnings("deprecation")
public void initializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner)
		throws HibernateException {
	final Type collectionElementType = persister.getElementType();
	final Serializable[] cachedSnapshot = (Serializable[]) disassembled;
	for ( Serializable cachedItem : cachedSnapshot ) {
		final Object object = collectionElementType.assemble( cachedItem, getSession(), owner );
		final Element subElement = element.addElement( persister.getElementNodeName() );
		collectionElementType.setToXMLNode( subElement, object, persister.getFactory() );
	}
}