I first off, you are using the QueryOver API, not the linq provider.

We would need to see your mappings because the foreign key inner join would
be created in your mappings.  There could be one-to-many, many-to-many,
many-to-one relationships between moveis and actors, you need to write that
in your mappings.

Then your query would look something like

var results =
(from m in session.Query(movies)
from a in m.actors
where m.id = "999"
order by m.name asc
select new { Id = m.id, MovieName = m.name, a.name, a.birthdate }.ToList();

this would put your your results in a list of anonymous types.



On Mon, Nov 26, 2012 at 4:01 PM, WildMind <[email protected]> wrote:

>
> **
>
> I am a newbie on the nhibernate linq. In my code I am creating a session
> object to query an nhiberate class. I need to join this class with another
> table and need to apply the where and select columns parmeters. Here is
> what I am doing:
>
>  IQueryable<MOVIES_DB> query =
>                 session.QueryOver<MOVIE_DB>()
>                 .OrderBy(mov => mov.name).Asc
>                 .Inner.JoinQueryOver<actors>
>
> I am not sure how to complete it. I need do the following
>
>    - join the movies and actors tables, which have the key relationship,
>    actor_id
>    - from the join tables, need to select columns, mov.id, mov.name,
>    actors.name, actors.birthdate
>    - need to apply the where , which gives me back all the records where
>    mov.id == "999"
>
> any help is appreciated.
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/nhusers/-/UPA2HdLdYdcJ.
> 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.
>

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