About Question com.enthuware.ets.scbcd.v5.2.126 : test 3 question

Moderator: admin

Post Reply
Alex

About Question com.enthuware.ets.scbcd.v5.2.126 : test 3 question

Post by Alex »

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

admin
Site Admin
Posts: 10090
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question com.enthuware.ets.scbcd.v5.2.126 : test 3 question

Post by admin »

Hi Alex,
Which container (and version) are you using to fire the query. As the explanation notes, Sun's reference implementation for EJB 3.0 produces the query with distinct.

thank you,
Paul.
If you like our products and services, please help us by posting your review here.

Alex

Re: About Question com.enthuware.ets.scbcd.v5.2.126 : test 3 question

Post by Alex »

Hi Paul,
I'm using Glassfish Enterprise Server v2.1.1 ((v2.1 Patch06)(9.1_02 Patch12)), whith Toplink essentials as persistence provider (default). Isn't it the sun IR ?
regards,
Alex

admin
Site Admin
Posts: 10090
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question com.enthuware.ets.scbcd.v5.2.126 : test 3 question

Post by admin »

Yes, this should be the one. I need to investigate more on this because I remember there was a discussion about this situation a couple of year ago and we verified that the query generated by GF had distinct. Either it GF was broken then or it is broken now.
If you like our products and services, please help us by posting your review here.

Alex

Re: About Question com.enthuware.ets.scbcd.v5.2.126 : test 3 question

Post by Alex »

Hi,
Any news about this question ?
thanks by advance,
Alex

admin
Site Admin
Posts: 10090
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question com.enthuware.ets.scbcd.v5.2.126 : test 3 question

Post by admin »

I think you are right. I am not sure what version it was tested on and I am not able to reproduce the behaviour defined in the latest version.

This should be fixed.

thanks for your feedback!
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests