Is there a bug??
However, I did miss that there was a join in the sub-query ... you could
try:
.WithSubquery.WhereExists(
QueryOver.Of<PlayerInTeam>()
.JoinQueryOver(pit => pit.Roster)
.Where(r => r.Team == team)
.Select(r => r.Id))
-----Original Message-----
From: Michael Delva
Sent: Thursday, October 28, 2010 9:04 AM
To: nhusers
Subject: [nhusers] Re: Convert a HQL query with QueryOver
Thanks for your answer.
This gives me another error :
System.ArgumentException: Could not find a matching criteria info
provider to: Roster.Team = Emidee.CommonEntities.Team
I've searched around on google, and it seems to be an known and not
fixed yet bug.
I'll continue to use my HQL query until I can find some more
informations about that.
Thanks again
Mike
On 28 oct, 09:26, "Richard Brown \(gmail\)" <[email protected]>
wrote:
I think you need a projection (select) on the sub-query:
.WithSubquery.WhereExists(
QueryOver.Of<PlayerInTeam>()
.Where(pit => pit.Roster.Team == team)
.Select(pit => pit.Id))
-----Original Message-----
From: Michael Delva
Sent: Wednesday, October 27, 2010 1:58 PM
To: nhusers
Subject: [nhusers] Convert a HQL query with QueryOver
Hello all,
I have this small query, written in HQL :
return Session.CreateQuery("from Player p where p.Visible and exists
(from PlayerInTeam pit where pit.Player = p and pit.Roster.Team
= :teamId)")
.SetParameter("teamId", team.Id)
.Enumerable<Player>();
I'd like to write it using the new QueryOver syntax.
Currently, I have:
return Session.QueryOver<Player>()
.Where(p => p.Visible)
.WithSubquery.WhereExists(QueryOver.Of<PlayerInTeam>().Where(pit
=> pit.Roster.Team == team))
.List();
But this throws this exception:
NHibernate.QueryException: Cannot use subqueries on a criteria without
a projection.
Could you tell me what's wrong?
Thanks in advance
--
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
athttp://groups.google.com/group/nhusers?hl=en.
--
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.
--
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.