This is not the issue tracker.
On Tue, Jul 5, 2011 at 9:45 AM, james <[email protected]> wrote:
> I have a issue with QueryOver,
>
> I have 2 tables.
>
> 1st table is Person table.
>
> And a person has many addresses.
> so my 2nd table is Addresses.
>
> Ist table
>
> Id
> Person name
>
> Second table
>
> addressid
> street1
> street2
> postcode
> city
> country
> PersonId
>
> say I want to query the address table by city and find the persons
> with city say = 'texas' and person name as say = 'john'
>
> var detachedAddressQueryOver = QueryOver.Of<Address>()
> .Where(x => x.City.IsLike("%" + city + "%"))
> .Select(x => x.Person.Id); //project PersonrId
>
> queryOverList = Session.QueryOver<Person>()
> .Where(x => x => x.Name).IsLike("%" + name + "%"))
> .WithSubquery
> .WhereProperty(x => x.Id)
> .In(detachedAddressQueryOver)
>
> But the problem is that every person in Person table does not have a
> address and hence does not have a city.
> So if I only search by name and pass in null for city, since it has
> only a few persons, returns all of the to the with subquery function.
>
> Say personId 1 and 2 will be there in the address table, so if you
> search by null for city, it will return only 1 and 2. So I need a way
> to ommit detachedAddressQueryOver when city is null.
>
>
>
--
Fabio Maulo