During my database you will find these three tables, amongst others

My database model

TRANSLATION includes a non-nullable foreign answer to UNIT along with a nullable foreign answer to ASSIGNMENT. UNIT might have more TRANSLATIONS designated.

I wish to execute a single query which returns an effect using the following structure:

Language | Assignment | First SUM | Second SUM | Third SUM
==========================================================
    1    |     2      |    456    |    126     |     0                      
    1    |     3      |   5361    |   1367     |    89
   ...   |    ...     |    ...    |    ...     |   ...

The outcomes could be arranged by TRANSLATION.fk_language and TRANSLATION.fk_assignment. The primary problem for me personally would be to fill the rest of the posts:

First SUM = SUM(unit.word_count)
Second SUM = SUM(unit.word_count) WHERE translation.status = 1
Third SUM = SUM(unit.word_count) WHERE translation.status = 2

Even when I restrict myself towards the First SUM column within the result, I can not have it working:

var result = session.QueryOver<Translation>()
                                .JoinQueryOver<Unit>(x => x.Unit)
                                .Select(Projections.Group<Translation>(x => x.Language),
                                        Projections.Group<Translation>(x => x.Assignment),                                            
                                        Projections.Sum<Unit>(x => x.WordCount))
                                .List<object>()
                                .ToList();

This fails with

couldn't resolve property: WordCount of: Organizations.Translation

Thanks greatly for just about any suggestions.

EDIT: Listed here are my mappings:

public class TranslationMap : ClassMap<Translation>
{
    public TranslationMap()
    {
        Table("\"TRANSLATION\"");
        LazyLoad();            
        Id(x => x.Id, "id").GeneratedBy.HiLo("hilo", "hilo_translation", "200");
        Map(x => x.Status).Column("status");
        References<Language>(x => x.Language, "fk_id_language").Not.Nullable().Cascade.None();
        References<Unit>(x => x.Unit, "fk_id_translation_unit").Cascade.None();
        References<Assignment>(x => x.Assignment, "fk_id_translator_assignment").Nullable().Cascade.None();
        DynamicUpdate();
    }
}

public class UnitMap: ClassMap<Unit>
{
    public UnitMap()
    {
        Table("\"UNIT\"");
        LazyLoad();            
        Id(x => x.Id, "id").GeneratedBy.HiLo("hilo", "hilo_translation_unit", "200");            
        Map(x => x.Text).Column("text");            
        Map(x => x.WordCount).Column("word_count");            
        HasMany(x => x.Translations).Inverse().KeyColumn("fk_id_translation_unit").Cascade.None();           
    }
}

public class AssignmentMap : ClassMap<Assignment>
{
    public AssignmentMap()
    {
        Table("\"TRANSLATOR_ASSIGNMENT\"");
        LazyLoad();            
        Id(x => x.Id, "id").GeneratedBy.HiLo("hilo", "hilo_translator_assignment", "50");           
    }
}

Have you map the WordCount of property of the Unit entity? (have you got a hbm.xml such as this)

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" >
  <class name="Unit">
    <id name="Id" column="Id" type="Int32" >
      <generator class="native" />
    </id>
    <property name="WordCount" colum="word_count"/>
  </class>
</hibernate-mapping>