You need to join Equipament table first, before accessing Company.

in the first query, you can add "where equipament.id = x" because
equipament Id is held in Laudo table (as Equipament_Id by default).
However, when you are about to query Company table, you need to join Laudo
and Equipament before accessing Company_Id column of Equipament table.

I wish it helps

On Sun, Jul 8, 2012 at 11:42 PM, Felipe Oriani <[email protected]>wrote:

> Hello guys,
>
> I have a asp.net mvc application with NHibernate and I do not know how to
> resolve a problem to query some data. I have this query:
>
> // create query
>
> var query = session.QueryOVer<Laudo>().Fetch(x => x.Equipament).Eager;
>
>
> // add some filters
>
> if (idEquipament.HasValue)
>
>
>   query = query.And(x => x.Equipament.Id == idEquipament.Value);
>
>
> //I got the error here...
>
> if (idCompany.HasValue)
>
>
>   query = query.And(x => x.Equipament.Company.Id == idCompany.Value);
>
>  When I try to execute this query, I've got an exception with this
> message: "*could not resolve property: Equipament.Company.Id of:
> DomainModel.Laudo*"
>
> what can I do to fix this problem?
>
> Thanks
>
> --
> ______________________________________
> Felipe B. Oriani
>
> "...Trabalhe quanto puder, tornando-se útil quanto possível..." , por
> André Luiz
>
>  --
> 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.
>



-- 

Sadullah Ceran,
[image: LinkedIn] <http://www.linkedin.com/in/sadullahceran> [image:
Twitter] <http://www.twitter.com/sadullahceran> [image:
Facebook]<https://www.facebook.com/ceran>

-- 
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