Hi,
I am struggling to construct an HCQ, and would appreciate any help that you may able to give me.
Lets start with the mapping for the "Item" entity:
Code:
        <map name="NumberRequiredPerDay" lazy="false">
            <key column="ItemId"></key>
            <index column="Date" type="DateTime"></index>
            <element type="int" column="NumberRequired"></element>
        </map>
I have another query which uses a subquery containing a distinct list of Dates which have a NumberRequired > 0 from the Item entity.
To achieve this, I have constructed the following HCQ:
Code:
   DetachedCriteria SubQuery = DetachedCriteria.For<Item>()
      .SetProjection(Projections.ProjectionList()
         .Add(Projections.Property("NumberRequiredPerDay.Date")) // Understandably does not work, but not sure what to replace it with.
      )
      .Add(Restrictions.Eq("ID", ID))
   ;
   return session.CreateCriteria<OtherItem>()
                // Other Query Criteria Goes Here
      .Add(Subqueries.PropertyIn("OtherItem.Dates.Date", SubQuery))
      .List<OtherItem>();
However, I cannot find a way to project the Date value from the Item entity in the subquery, as commented in the code above.
I would really appreciate it if someone could lend a hand.