• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

enthuware JPQL Question query

 
Ranch Hand
Posts: 142
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you try it ?
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 .
 
Get out of my mind! Look! A tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic