views:

185

answers:

2

Hi

I have the version 3.0.0.1001 nhibernate.

My objects are basically modeiling a lineup at an event. So I have a StageSet object which represents one slot in the schedule for a stage.

Each StageSet object has a Stage and an Act property.

It also has many Users - people who have favorited the set.

I'm trying to ascertain the most popular sets that have been favorited using the following linq:

var topStars = from s in Db.StageSets
                           group s by s.Act.Id into g
                           select new { SetKey = g.Key, Count = g.Count() };

However this just fails with a Could not execute query[SQL: SQL not available] error

Should I be able to do this?

w://

A: 

You've specified the query correctly in linq. NHibernate is refusing to translate it.

David B
Hmmm - is there a way i can do this in HQL?
cvista
A: 

I just copied your query with a slightly different domain and it worked. But that will count StageSets by Act, NOT favorites.

Diego Mijelshon