Java Code Examples for org.hibernate.transform.ResultTransformer#transformList()

The following examples show how to use org.hibernate.transform.ResultTransformer#transformList() . 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
Source File: CustomLoader.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
protected List getResultList(List results, ResultTransformer resultTransformer) throws QueryException {
	// meant to handle dynamic instantiation queries...(Copy from QueryLoader)
	HolderInstantiator holderInstantiator = HolderInstantiator.getHolderInstantiator(
			null,
			resultTransformer,
			getReturnAliasesForTransformer()
	);
	if ( holderInstantiator.isRequired() ) {
		for ( int i = 0; i < results.size(); i++ ) {
			Object[] row = (Object[]) results.get( i );
			Object result = holderInstantiator.instantiate( row );
			results.set( i, result );
		}

		return resultTransformer.transformList( results );
	}
	else {
		return results;
	}
}
 
Example 2
Source File: QueryLoader.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected List getResultList(List results, ResultTransformer resultTransformer) throws QueryException {
	// meant to handle dynamic instantiation queries...
	HolderInstantiator holderInstantiator = buildHolderInstantiator( resultTransformer );
	if ( holderInstantiator.isRequired() ) {
		for ( int i = 0; i < results.size(); i++ ) {
			Object[] row = (Object[]) results.get( i );
			Object result = holderInstantiator.instantiate( row );
			results.set( i, result );
		}

		if ( !hasSelectNew() && resultTransformer != null ) {
			return resultTransformer.transformList( results );
		}
		else {
			return results;
		}
	}
	else {
		return results;
	}
}
 
Example 3
Source File: CustomLoader.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
protected List getResultList(List results, ResultTransformer resultTransformer) throws QueryException {
	// meant to handle dynamic instantiation queries...(Copy from QueryLoader)
	HolderInstantiator holderInstantiator = HolderInstantiator.getHolderInstantiator(
			null,
			resultTransformer,
			getReturnAliasesForTransformer()
	);
	if ( holderInstantiator.isRequired() ) {
		for ( int i = 0; i < results.size(); i++ ) {
			Object[] row = ( Object[] ) results.get( i );
			Object result = holderInstantiator.instantiate(row);
			results.set( i, result );
		}
		
		return resultTransformer.transformList(results);
	}
	else {
		return results;
	}
}
 
Example 4
Source File: QueryLoader.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
protected List getResultList(List results, ResultTransformer resultTransformer) throws QueryException {
	// meant to handle dynamic instantiation queries...
	HolderInstantiator holderInstantiator = HolderInstantiator.getHolderInstantiator(selectNewTransformer, resultTransformer, queryReturnAliases);
	if ( holderInstantiator.isRequired() ) {
		for ( int i = 0; i < results.size(); i++ ) {
			Object[] row = ( Object[] ) results.get( i );
			Object result = holderInstantiator.instantiate(row);
			results.set( i, result );
		}

		if(!hasSelectNew() && resultTransformer!=null) {
			return resultTransformer.transformList(results);
		} else {
			return results;
		}
	} else {
		return results;
	}
}