About Question com.enthuware.ets.scbcd.v5.2.126 : test 3 question
Posted: Sat May 28, 2011 10:36 am
Hi,
I think there is a mistake in the results exposed in the solution and thus in your explanation.
My opinion is that for query number 3 the answer is 4 students returned :
there is 2 students associated both with 2 presentations, so with join the query will return an occurence for each student per presentation. To conclude a list of 2 duplicate students is returned. So the size if 4.
In your explanation for this number 3 JPQL Query , you give a sample of the generated sql query where DISTINCT appears. But tests with EJBPlus application (congratulation ! it's a great idea for training) the generated query is :
SELECT t0.ID, t0.LASTNAME, t0.ROLLNUMBER, t0.FIRSTNAME, t0.SCORE FROM STUDENT t0, PRESENTATION t1 WHERE (t1.PRESENTER_ID = t0.ID)
No DISTINCT appears.
FOR having a distinct segregation we must use the DISTINCT keyword in the JPQL query.
My tests whith your app tend to prove my assertion.
Similary, the last query will return (if i don't mistake) 8.
The FROM clause whith 2 joins conducts to (start point : Presentation):
4 presentations "associated" each with their respective "Student" whose in turn are each "associated" with their 2 presentations => 8 occurences
So result seems to be 8 for me.
Sorry for my bad english.
Best regards,
Alex
I think there is a mistake in the results exposed in the solution and thus in your explanation.
My opinion is that for query number 3 the answer is 4 students returned :
there is 2 students associated both with 2 presentations, so with join the query will return an occurence for each student per presentation. To conclude a list of 2 duplicate students is returned. So the size if 4.
In your explanation for this number 3 JPQL Query , you give a sample of the generated sql query where DISTINCT appears. But tests with EJBPlus application (congratulation ! it's a great idea for training) the generated query is :
SELECT t0.ID, t0.LASTNAME, t0.ROLLNUMBER, t0.FIRSTNAME, t0.SCORE FROM STUDENT t0, PRESENTATION t1 WHERE (t1.PRESENTER_ID = t0.ID)
No DISTINCT appears.
FOR having a distinct segregation we must use the DISTINCT keyword in the JPQL query.
My tests whith your app tend to prove my assertion.
Similary, the last query will return (if i don't mistake) 8.
The FROM clause whith 2 joins conducts to (start point : Presentation):
4 presentations "associated" each with their respective "Student" whose in turn are each "associated" with their 2 presentations => 8 occurences
So result seems to be 8 for me.
Sorry for my bad english.
Best regards,
Alex