public string ContinueFromManyToMany(System.Type clazz, string[] joinColumns, QueryTranslator q)
        {
            Start(q);
            continuation = true;
            currentName  = q.CreateNameFor(clazz);
            q.AddType(currentName, clazz);
            IQueryable classPersister = q.GetPersister(clazz);

            join.AddJoin(classPersister.TableName, currentName, joinColumns, classPersister.IdentifierColumnNames, joinType);
            currentPropertyMapping = classPersister;
            return(currentName);
        }
        public string ContinueFromManyToMany(string clazz, string[] joinColumns, QueryTranslator q)
        {
            Start(q);
            continuation = true;
            currentName  = q.CreateNameFor(clazz);
            q.AddType(currentName, clazz);
            IQueryable classPersister = q.GetPersister(clazz);

            AddJoin(currentName, TypeFactory.ManyToOne(clazz), joinColumns);
            currentPropertyMapping = classPersister;
            return(currentName);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="propertyName"></param>
        /// <param name="propertyType"></param>
        /// <param name="q"></param>
        /// <remarks>NOTE: we avoid joining to the next table if the named property is just the foreign key value</remarks>
        private void DereferenceEntity(string propertyName, EntityType propertyType, QueryTranslator q)
        {
            //if its "id"
            bool isIdShortcut = EntityID.Equals(propertyName) && !propertyType.IsUniqueKeyReference;

            //or its the id property name
            string idPropertyName;

            try
            {
                idPropertyName = propertyType.GetIdentifierOrUniqueKeyPropertyName(q.Factory);
            }
            catch (MappingException me)
            {
                throw new QueryException(me);
            }
            bool isNamedIdPropertyShortcut = idPropertyName != null && idPropertyName.Equals(propertyName);

            if (isIdShortcut || isNamedIdPropertyShortcut)
            {
                // special shortcut for id properties, skip the join!
                // this must only occur at the _end_ of a path expression
                DereferenceProperty(propertyName);
            }
            else
            {
                System.Type entityClass = propertyType.AssociatedClass;
                String      name        = q.CreateNameFor(entityClass);
                q.AddType(name, entityClass);
                IQueryable memberPersister = q.GetPersister(entityClass);
                //String[] keyColNames = memberPersister.getIdentifierColumnNames();
                string[] keyColNames;
                try
                {
                    keyColNames = propertyType.GetReferencedColumns(q.Factory);
                }
                catch (MappingException me)
                {
                    throw new QueryException(me);
                }
                AddJoin(memberPersister.TableName, name, keyColNames);
                if (propertyType.IsOneToOne)
                {
                    oneToOneOwnerName = currentName;
                }
                currentName     = name;
                currentProperty = propertyName;
                q.AddPathAliasAndJoin(path.Substring(0, path.LastIndexOf(StringHelper.Dot)), name, join);
                componentPath = null;
                //componentPath = new StringBuilder( );
                currentPropertyMapping = memberPersister;
            }
        }