Java Code Examples for org.hibernate.loader.custom.Return

The following examples show how to use org.hibernate.loader.custom.Return. 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
Source Project: lams   Source File:    License: GNU General Public License v2.0 6 votes vote down vote up
private EntityAliases[] interpretEntityAliases(List<Return> customQueryReturns) {
	final List<EntityAliases> entityAliases = new ArrayList<>();
	for ( Return queryReturn : customQueryReturns ) {
		if ( !RootReturn.class.isInstance( queryReturn ) ) {

		entityAliases.add( ( (RootReturn) queryReturn ).getEntityAliases() );

	if ( entityAliases.isEmpty() ) {
		return NO_ALIASES;

	return entityAliases.toArray( new EntityAliases[ entityAliases.size() ] );
Example 2
Source Project: lams   Source File:    License: GNU General Public License v2.0 5 votes vote down vote up
private static CustomLoaderExtension buildSpecializedCustomLoader(final ResultContext context) {
	// might be better to just manually construct the Return(s).. SQLQueryReturnProcessor does a lot of
	// work that is really unnecessary here.
	final SQLQueryReturnProcessor processor = new SQLQueryReturnProcessor(
	final List<org.hibernate.loader.custom.Return> customReturns = processor.generateCallableReturns();

	CustomQuery customQuery = new CustomQuery() {
		public String getSQL() {
			return context.getSql();

		public Set<String> getQuerySpaces() {
			return context.getSynchronizedQuerySpaces();

		public List<ParameterBinder> getParameterValueBinders() {
			// no parameters in terms of embedded in the SQL string
			return Collections.emptyList();

		public List<org.hibernate.loader.custom.Return> getCustomQueryReturns() {
			return customReturns;

	return new CustomLoaderExtension(