(Separate) Benchmarks Equivalent for HQL Index Function

I have an IDictionary on an object that I load with the following mapping:

public class InternalFund : IInternalFund
{
    public virtual IDictionary<DateTime, IValuation> Valuations { get; set; }
}

<class name="InternalFund">
      <map name="Valuations">
        <key>
          <column name="FundID" />
        </key>
        <index type="DateTime" column="ValuationDate" />
        <one-to-many class="Echo.EchoDomain.Portfolio.Valuation" />
      </map>
</class>

      

This works great, the evaluator does not have a ValuationDate, but Nhibernate loads the ValuationDate into the dictionary key at will. I want to ask the InternalFund to get only one Valuation by specifying a ValuationDate. I was able to do this using the index () function in HQL:

"from InternalFund i left join fetch i.Valuations v where index(v)='2009-09-30'"

      

Again, this is fantastic and exactly what I want to create here, where:

((valuations1_.ValuationDate='2009-09-30' )) 

      

But I really would like to do this in DetachedCriteria to keep my project sane. When i try

.Add(Restrictions.Eq("index(Valuations)", valuationDate));

      

or

.CreateAlias("Valuations", "v", JoinType.LeftOuterJoin)
.Add(Restrictions.Eq("index(v)", valuationDate));

      

It says:

QueryException: could not resolve property: index(v) of: Echo.EchoDomain.Fund.InternalFund

      

Is there a way to run index () using DetachedCriteria?

thank

Stu

+2


source to share


1 answer


I believe this is not possible (yet?)



See this feature / request / enhancement request in NHibernate JIRA.

+1


source







All Articles