There is a one-to-many relationship between the entities Student
and Presentation (a student can have many presentations).
Student S1 refers to Presentations P1 and P2
Student S2 refers to Presentations P3 and P4
What's the size of the collection returned by the following query:
select s from Student s inner join s.presentations p
The given answer is: 2
Enthu's explanation: Since there is an inner join between Student and Presentation, it just selects all the
Students for which there is a presentation. Since there are 2 such Students, it returns a collection of size 2.
But to my understanding an inner join forms the cartesian product of the involved tables. So the join
should yield the table
S1 P1
S1 P2
S2 P3
S2 P4
Then, if the Students are selected the result should be S1, S1, S2, S2. So the answer would be 4. I also tried
this scenario with glassfish/toplink and the result was indeed 4.
What do you think ?