WoF_Angel
WoF_Angel

Reputation: 2581

NHibernate - HQL and In-Depth Inner Joins

I want to know the gallaxies which has planets that have sattelites of type 'Spy' and human species.

I'm having difficulty writing multiple inner joins of different depth levels.

Here is one of my tries:

select gal from Galaxy gal inner join gal.PlanetList planets
inner join planets.SattelitesList satts,
planets inner join planets.SpeciesList spec 
where spec.Name = 'Human' AND satts.Type = 'Spy'

I know that this works, but it has only one branch of depth (like a single branch of a binary tree):

select gal from Galaxy gal inner join gal.PlanetList planets
inner join planets.SattelitesList satts where satts.Type ='Spy'

Thanks

Upvotes: 0

Views: 1093

Answers (1)

Stefan Steinegger
Stefan Steinegger

Reputation: 64628

Doesn't work like this?

from
  gal from Galaxy gal 
  join gal.PlanetList planets
  join planets.SattelitesList satts
  join planets.SpeciesList spec 
where spec.Name = 'Human' AND satts.Type = 'Spy'

Upvotes: 3

Related Questions