File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Misunderstood Enthuware Questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Misunderstood Enthuware Questions" Watch "Misunderstood Enthuware Questions" New topic

Misunderstood Enthuware Questions

Amandeep Singh
Ranch Hand

Joined: Jul 17, 2008
Posts: 850
Which of the following statements are correct regarding Java Persistence Query Language (JPQL)?

1) A JPQL Query must contain a 'select' and a 'where' clause.

2) A JPQL query must contain a 'select', a 'where', and a 'from' clause.

3) A JPQL query must contain a 'select', and a 'from' clause.

4) JQPL queries are based on the database schema.

5) None of these.

the correct answer given is 5. Just for your information, in the previous version (EJB 2.0), the query language was called EJBQL and it only supported select queries. Now, in EJB 3.0, it is called JPQL and it supports all types of queries. The syntax of both is quite similar with minor differences. Some new built in functions have also been added. For the purpose of the exam, you don't have to worry about EJBQL. Just go through chapter 4 of EJB 3.0 Persistence specification. It is quite easy to understand.

According to me the correct answer is 3.

SCJP 1.4, SCWCD 5, SCBCD 5, OCPJWSD 5,SCEA-1, Started Assignment Part 2
My blog-
Imran Arif

Joined: Nov 16, 2008
Posts: 2
A JPQL query may be contain 'update' or 'delete' clause.

SCJP (91%), SCWCD (85%), Target SCBCD
Paul Anilprem
Enthuware Software Support
Ranch Hand

Joined: Sep 23, 2000
Posts: 3635
Amandeep, There is an explanation for every option in this question( Qid: com.enthuware.ets.scbcd.v5.2.177 ) . Did you read that?

Enthuware - Best Mock Exams and Questions for Oracle Java Certifications
Quality Guaranteed - Pass or Full Refund!
Bod Toki
Ranch Hand

Joined: Sep 01, 2006
Posts: 95
Query query = em.createQuery("UPDATE Post p SET p.body = 'this reply' WHERE p.user like '%Bod Toki%'");
int results = query.executeUpdate();

Query query = em.createQuery("DELETE Post p WHERE p.body = 'this reply''");
int results = query.executeUpdate();

These are valid JPQL queries and I do not see a 'SELECT' statement or 'FROM' clause...
When EJB3.0 talks about queries it means selects, updates, deletes.... not just selects.
Amandeep Singh
Ranch Hand

Joined: Jul 17, 2008
Posts: 850
ok ok i got it. I was wrong here.
I agree. Here's the link:
subject: Misunderstood Enthuware Questions
It's not a secret anymore!