private INativeSQLQueryReturn CreateQueryReturn(object item, int count)
        {
            HbmLoadCollection loadCollectionSchema = item as HbmLoadCollection;
            HbmReturn         returnSchema         = item as HbmReturn;
            HbmReturnJoin     returnJoinSchema     = item as HbmReturnJoin;
            HbmReturnScalar   returnScalarSchema   = item as HbmReturnScalar;

            if (returnScalarSchema != null)
            {
                return(CreateScalarReturn(returnScalarSchema));
            }

            else if (returnSchema != null)
            {
                return(CreateReturn(returnSchema, count));
            }

            else if (returnJoinSchema != null)
            {
                return(CreateJoinReturn(returnJoinSchema));
            }

            else if (loadCollectionSchema != null)
            {
                return(CreateLoadCollectionReturn(loadCollectionSchema));
            }

            else
            {
                return(null);
            }
        }
        private NativeSQLQueryCollectionReturn CreateLoadCollectionReturn(HbmLoadCollection loadCollectionSchema)
        {
            int dot = loadCollectionSchema.role.LastIndexOf('.');

            if (dot == -1)
            {
                throw new MappingException(
                          "Collection attribute for sql query return [alias=" + loadCollectionSchema.alias +
                          "] not formatted correctly {OwnerClassName.propertyName}"
                          );
            }

            string ownerClassName    = GetClassNameWithoutAssembly(loadCollectionSchema.role.Substring(0, dot));
            string ownerPropertyName = loadCollectionSchema.role.Substring(dot + 1);

            //FIXME: get the PersistentClass
            IDictionary <string, string[]> propertyResults = BindPropertyResults(loadCollectionSchema.alias, null, loadCollectionSchema.returnproperty, null);

            return(new NativeSQLQueryCollectionReturn(loadCollectionSchema.alias, ownerClassName, ownerPropertyName,
                                                      propertyResults, GetLockMode(loadCollectionSchema.lockmode)));
        }