views:

311

answers:

2

Hi!

I'm trying to find a good documentation which states exactly, what query by example is capable of and what not.

In particular, I want to know, if query by example supports a search like the following: I want to get all Persons which have a location with a certain name.

public class Person
{
    public virtual IList<Location> Locations { get; set; }
}

public class Location
{
    public virtual string Name { get; set; }
}

Best Regards,
Oliver Hanappi

+1  A: 

While not really answering the question it might help you anyway. From my experience query by example is not really useful. I'd suggest you to use either Criteria or HQL which allow much more granularity.

Rashack
I beg to differ. For simple queries it is a VERY powerful querying mechanism.
Jason Irwin
And I agree with that. However it's just the very simple queries and for quite simple domains as well. So although I could use QBE in rare cases for the sake of consistency I tend to do all the stuff with Criteria.
Rashack
A: 

You should take a look at videos 2 and 2a of the Summer of NHibernate screencasts (link). One of these covers query by example. If you haven't already watched these videos i STRONGLY recommend them both for content and the quality of presentation.

Jason Irwin