Java Mailing List Archive

http://www.gg3721.com/

Home » the NHibernate development list »

Re: [NHibernate-development] Strange bug when querying a circular
 graph with several joins

Will Shaver

2008-07-03

Replies: Find Java Web Hosting

Author LoginPost Reply
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 <fabiomaulo@gmail.com> 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
Nhibernate-development@lists.sourceforge.net
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
Nhibernate-development@(protected)
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
©2008 gg3721.com - Jax Systems, LLC, U.S.A.