Thanks man, I found the solution using JoinAlias method :) Works great! []s
On Sun, Jul 8, 2012 at 6:37 PM, Felipe Oriani <[email protected]>wrote: > Hi Sadullah, thanks for the awser but I am new using nhibernate. Do you > have sample of how to do this join? > Thanks > > > On Sun, Jul 8, 2012 at 6:10 PM, Sadullah Ceran <[email protected]>wrote: > >> 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. >> > > > > -- > ______________________________________ > Felipe B. Oriani > felipeoriani.com.br [email protected] > @felipeoriani<http://www.twitter.com/felipeoriani> > LinkedIn <http://br.linkedin.com/in/felipeoriani> > Facebook<http://www.facebook.com/felipeoriani> > Contato: (19) 9611-8646 / (19) 3421-7850 > > > "...Trabalhe quanto puder, tornando-se útil quanto possível..." , por > André Luiz > > > -- ______________________________________ Felipe B. Oriani felipeoriani.com.br [email protected] @felipeoriani<http://www.twitter.com/felipeoriani> LinkedIn <http://br.linkedin.com/in/felipeoriani> Facebook<http://www.facebook.com/felipeoriani> Contato: (19) 9611-8646 / (19) 3421-7850 "...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.
