Re: Strange bug when querying acirculargraph with several joins
"Chris Smith" <[email protected]>
| Newsgroups | gmane.comp.windows.dotnet.nhibernate.devel |
|---|---|
| Message-ID | <93BA6C2C05B6974A9F25DA49D4F046BA0256FF90@EXVBE014-13.exch014.msoutlookonline.net> |
But of course! Sincere apologies by the way - "CriteriaByLongAlias" solves the problem. Users list first in future. Regards Chris From: [email protected] [mailto:[email protected]] On Behalf Of Will Shaver Sent: 03 July 2008 18:01 To: the NHibernate development list Subject: Re: [NHibernate-development] Strange bug when querying acirculargraph with several joins We only ask that you give back by answering other people's questions... On Thu, Jul 3, 2008 at 9:51 AM, Chris Smith <[email protected]> wrote: Thanks for that Will. We're using C# 3.0 and .NET 3.5. I'm running the breaking test against the current trunk of NHibernate. I'll try this out and then take the problem to the users list. Thanks so much to those who have replied to this post. I have been very pleasantly surprised! Chris From: [email protected] [mailto:[email protected]] On Behalf Of Will Shaver Sent: 03 July 2008 16:44 To: the NHibernate development list Subject: Re: [NHibernate-development] Strange bug when querying a circulargraph with several joins What version of c# and nh are you using? Here's an extension method that I use for these type of of problems public static ICriteria CriteriaByLongAlias(this ICriteria criteria, string field) { ICriteria byAlias = criteria.GetCriteriaByAlias(criteria.Alias + "_" + field); if(byAlias == null) byAlias = criteria.CreateCriteria(field, criteria.Alias + "_" + field); return byAlias; } Use this as follows: ICriteria criteria = NHsession.CreateCriteria(typeof(Role)); ICriteria primaryLocationCriteria = criteria.CriteriaByLongAlias("PrimaryLocation"); ICriteria addressCriteria = primaryLocationCriteria.CriteriaByLongAlias("Address"); addressCriteria.Add(Expression.Like("Postcode", "BS%")); If you review CriteriaImpl.cs you will note that while CreateAlias returns the original criteria, CreateCritieria returns the subcriteria. I've found it best to ignore CreateAlias. On Thu, Jul 3, 2008 at 7:03 AM, Fabio Maulo <[email protected]> wrote: Hi Chris, You can start from one of the users forums http://groups.google.com.ar/group/nhusers Our issue tracker is (only for bugs, improvement etc.) : http://jira.nhibernate.org/secure/Dashboard.jspa Thanks -- Fabio Maulo ------------------------------------------------------------------------ - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Nhibernate-development mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nhibernate-development ------------------------------------------------------------------------ - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Nhibernate-development mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nhibernate-development ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Nhibernate-development mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nhibernate-development