That is not the best domain to make an example but now that I know the
domain perhaps I can write a different OO query
select s, size(s.Enrolments) from Student s group by s, s.Name,
s.PreferredCourse

2009/10/28 Michal Drozd [toper] <[email protected]>

>
> Hi Fabio,
>
> I tried that , but it fails (I am using nh test project):
> The query string is: "select s, size(s.Enrolments) from Student s",
> and the exception:
>
> NHibernate.Test.Criteria.ProjectionsTest.GetStudentAndCountOfEnrolments:
> NHibernate.ADOException : could not execute query
> [ select student0_.studentId as col_0_0_, count
> (enrolments1_.studentId) as col_1_0_, student0_.studentId as
> studentId1_, student0_.Name as Name1_, student0_.preferredCourseCode
> as preferre3_1_ from Student student0_, Enrolment enrolments1_ where
> student0_.studentId=enrolments1_.studentId ]
> [SQL: select student0_.studentId as col_0_0_, count
> (enrolments1_.studentId) as col_1_0_, student0_.studentId as
> studentId1_, student0_.Name as Name1_, student0_.preferredCourseCode
> as preferre3_1_ from Student student0_, Enrolment enrolments1_ where
> student0_.studentId=enrolments1_.studentId]
>  ----> System.Data.SqlClient.SqlException : Column
> 'Student.studentId' is invalid in the select list because it is not
> contained in either an aggregate function or the GROUP BY clause.
>
> On Oct 28, 5:03 am, Fabio Maulo <[email protected]> wrote:
> > select p, size(p.Children) from Parent p
> >
> > Fabio Maulo
> >
>


-- 
Fabio Maulo

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to