private void CreateCriteriaCollectionPersisters()
 {
     foreach (KeyValuePair <string, ICriteria> me in associationPathCriteriaMap)
     {
         NHibernate_Persister_Entity.IJoinable joinable = GetPathJoinable(me.Key);
         if (joinable != null && joinable.IsCollection)
         {
             criteriaCollectionPersisters.Add((ICollectionPersister)joinable);
         }
     }
 }
        private Persister.Entity.IJoinable GetPathJoinable(string path)
        {
            NHibernate_Persister_Entity.IJoinable        last       = (NHibernate_Persister_Entity.IJoinable)Factory.GetEntityPersister(rootEntityName);
            NHibernate_Persister_Entity.IPropertyMapping lastEntity = (NHibernate_Persister_Entity.IPropertyMapping)last;

            string componentPath = "";

            StringTokenizer tokens = new StringTokenizer(path, ".", false);

            foreach (string token in tokens)
            {
                componentPath += token;
                IType type = lastEntity.ToType(componentPath);
                if (type.IsAssociationType)
                {
                    if (type.IsCollectionType)
                    {
                        // ignore joinables for composite collections
                        var collectionType = (CollectionType)type;
                        var persister      = Factory.GetCollectionPersister(collectionType.Role);
                        if (persister.ElementType.IsEntityType == false)
                        {
                            return(null);
                        }
                    }
                    IAssociationType atype = (IAssociationType)type;

                    last          = atype.GetAssociatedJoinable(Factory);
                    lastEntity    = (NHibernate_Persister_Entity.IPropertyMapping)Factory.GetEntityPersister(atype.GetAssociatedEntityName(Factory));
                    componentPath = "";
                }
                else if (type.IsComponentType)
                {
                    componentPath += '.';
                }
                else
                {
                    throw new QueryException("not an association: " + componentPath);
                }
            }
            return(last);
        }