I came up with a workaround that looks as follows:
var sqlProjection = Projections.SqlProjection("{alias}.note AS
note_value", new[] { "note_value" }, new[] { NHibernateUtil.String });
companyQuery.CreateCriteria<Company>(c => c.Notes) // I am using
lamdba extensions to criteria
.Add(Restrictions.Eq(sqlProjection, "some
text"));
The problem I get into is the note table alias in the JOIN condition
is different from the WHERE condition causing the query to fail.
Giving name to the criteria makes no difference as it only changes the
alias of the table in the WHERE condition. Does it sound like an
NHibernate bug?
I can get around the problem using a SELECT query inside the
projection but it is really ugly.
--
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.