Unwanted loading formula not working with QueryOver

I have a formula defined in a mapping as shown below.

public TextMap()
    {
        base.Table("text");
        base.Id(x => x.Id).Column("id").GeneratedBy.Assigned();
        base.Map(x => x.Subject).Column("[subject]");
        base.Map(x => x.CountOver).Formula("(count(*) over())").LazyLoad();
    }

If I try to load the number of queries during a search using the code below, nhibernate does not include a column in the select statement at all.

var results = Session.QueryOver<Text>().Fetch(x=>x.CountOver).Eager().List();

instead, if I use the code below, it includes a column in the select statement.

var results = Session.CreateQuery("from Text fetch all properties").List<Text>();

Is there an error in the criteria or queryover to get the formula to look forward to loading, or am I missing something in my code?

+3
source share

All Articles