Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

enthuware JPQL Question query

 
Meherdad Bomanbehram
Ranch Hand
Posts: 142
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
could some one please explain how option 2 "SELECT c FROM Student s, IN(s.course) AS c where s.grade='A'" in this question "com.enthuware.ets.scbcd.v5.2.181" is vaild ?

Which of the following JPQL queries are correct?
select 3 options
1 select student.name from Student
2 SELECT c FROM Student s, IN(s.course) AS c where s.grade='A'
3 SELECT s FROM Student s WHERE s.grade BETWEEN 'A' and 'C'
4 SELECT s FROM Student s WHERE s.score NOT IN (90, 80, 70)


I agree with the fact that the first one is incorrect as
You cannot use the abstract persistent schema name (here, Student) as the name of the variable.
and that 3 and 4 are correct but I can not see option 2 working corectly
Please help
Msany thanks

 
Ralph Jaus
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try it ?
 
Stefan Taranu
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why shouldn't be correct?

SELECT c FROM Student s, IN(s.course) AS c where s.grade='A' can be substituted with
SELECT c FROM Student s [INNER] JOIN s.course AS c where s.grade='A' that is correct.

For more examples see JPA specs (page 85-86)
 
Meherdad Bomanbehram
Ranch Hand
Posts: 142
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ralph and Stefan Taranu , I tried it and it works and I have also started learning the specs not just the books . Thank You .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic