tinonetic
tinonetic

Reputation: 8036

Querying indirectly associated entities in HQL

NB: I am using NHibernate 2.1 (for legacy code support)

If I have three entities:

  1. A related to B
  2. C related to B

That is, having the following properties:

Entity A

A
- id
- B

Entity B

B
- id

Entity C

C
- id
- B

How do I do it using a non-theta-style join?

If I try something like this

from A a
inner join a.B b
inner join C.b cB
where
a.B_id = b.id and
cB.id = b.id

I get the exception: Path expected for join!

Is a theta join the only way I can get it to work or am I missing something?

If I have no direct association from A to C why can I not associate through another entity? Or does this not work?

Upvotes: 0

Views: 52

Answers (0)

Related Questions