Oh crud .... typical!!!!!!
Nope we can't test ... cos we are having to use an old build of NH,
because we are using an old build of NH Search, cos we are using
Lucene (all of which is in itself a nightmare!!!!) (anyone got any
idea when NH Search/Lucene/NH will be in synch again?)
I was just playing around and came up with this alternative ... any
ideas if it is better/worse/indifferent? Seems to work ok (from quick
test) ....
var newsGroupTitles = new[] { "Steel News" };
var tagTitles = new[] { "Asia" };
var tags = DetachedCriteria.For<Tag>()
.Add(Property.ForName("Title").In(tagTitles))
.SetProjection(Projections.Id());
var ngs = DetachedCriteria.For<NewsGroup>()
.Add(Property.ForName("Title").In(newsGroupTitles))
.SetProjection(Projections.Id());
var criteria = DetachedCriteria.For(typeof(Article), "article")
.Add(Subqueries.Exists(tags))
.Add(Subqueries.Exists(ngs));
criteria.SetMaxResults(15);
var articles = ActiveRecordMediator<Article>.FindAll(criteria);
Console.WriteLine(articles.Length);
On Oct 17, 11:09 am, "Tuna Toksöz" <[EMAIL PROTECTED]> wrote:
> ı think this was fixewd 2 days ago. can you verify?
>
> On 10/17/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
>
>
> > We have a small problem with what seemed to be an easy enough
> > query ...
>
> > var newsGroupTitles = new[] { "CRU Steel News" };
> > var tagTitles = new[] { "Steel sheet" };
> > var criteria = DetachedCriteria.For(typeof(Article),
> > "article")
> > .CreateCriteria("article.NewsGroupList", "newsGroups")
> > .Add(Property.ForName("newsGroups.Title").In(newsGroupTitles))
> > .CreateCriteria("article.TagList", "tags")
> > .Add(Property.ForName("tags.Title").In(tagTitles))
> > .AddOrder(new Order("article.Date", true));
>
> > Which returns back a list of articles that are in one of the newgroups
> > and one of the tags specified.
>
> > We only wanted the first 15 of these, so added a SetMaxResults to
> > this, but at this point NHiberante falls over.
>
> > //criteria.SetMaxResults(15); // This line causes the
> > query to break :-(
>
> > This causes:
> > System.Data.SqlClient.SqlException : The column 'articleid' was
> > specified multiple times for 'query'.
> > The column 'articleid' was specified multiple times for 'page'.
>
> > Any ideas how to fix this?
>
> --
> Tuna Toksöz
>
> Typos included to enhance the readers attention!- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---