Tuna came up with the following HQL which works ...

IList result = sess.CreateQuery("from Article a join a.TagList tag
join a.NewsGroupList newsGroup where tag.Title in (:tagtitle) or
newsGroup.Title in (:grouptitle) order by a.Date")
.SetParameterList("tagtitle", tagTitles)
.SetParameterList("grouptitle",
newsGroupTitles).SetMaxResults(15).List();

If anyone can figure out how to get it working via criterias I would
be grateful, but this will do as a less elegant solution for now ....


Thanks once again Tuna!!!!


Now ... any idea on when NH, NHSearch, Lucene, Castle, and Rhino
Commons will all play nicely together again????





On Oct 17, 4:17 pm, "Tuna Toksöz" <[EMAIL PROTECTED]> wrote:
> Or maybe creating a patch from the last revision and apply it onto the
> version he is using, then compile.
>
> 2008/10/17 Ayende Rahien <[EMAIL PROTECTED]>
>
>
>
>
>
> > Take the current MsSQL 2005 dialect, compile that as a separate assembly,
> > and use.
> > It should fix the issue, and has no deps on anything else.
>
> > 2008/10/17 [EMAIL PROTECTED] <[EMAIL PROTECTED]>
>
> >> OK - nope that alternative is bunkum and doesnt work ... any other
> >> ideas anyone?
>
> >> On Oct 17, 11:28 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> >> wrote:
> >> > 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 -- Hide quoted text -
>
> >> > - Show quoted text -
>
> --
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to