I'm just starting to pick up nHibernate having initially tried MS
Entity Framework and found some showstopper performance issues. Now,
I'm running into some with nHibernate. I'm pretty convinced that I
must be doing something wrong, so what is it?

An example:

I have a single class, PROJ_COMP. This class has a ISet of PROJ_COMP-
Children. Defined as follows:

    <set name="Children" fetch="join" lazy="false">
      <key column="PARENT_PROJ_COMP_NO"/>
      <one-to-many class="PROJ_COMP"/>
    </set>

and

public ISet<PROJ_COMP> Children { get; set; }
(in the PROJ_COMP class)

The following takes AGES to perform:

            var lst = _session.CreateQuery("select pc, chld from
PROJ_COMP as pc "+
                                           "left outer join
pc.Children as chld "+
                                           "where pc.PROJ_NO = 147 and
pc.PARENT_PROJ_COMP_NO is null").List();

What am I doing wrong here? My best estimate is that it takes 1 hour
20 minutes where Entity Framework does the same in 1 minute.

In plain English, my goal is to eager load all parent components and
all their children.

Reply via email to