• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Misunderstood Enthuware Questions

 
Ranch Hand
Posts: 856
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A JPQL query may be contain 'update' or 'delete' clause.
 
Enthuware Software Support
Posts: 4340
36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amandeep, There is an explanation for every option in this question( Qid: com.enthuware.ets.scbcd.v5.2.177 ) . Did you read that?
 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 856
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok ok i got it. I was wrong here.
 
Well behaved women rarely make history - Eleanor Roosevelt. tiny ad:
professionally read, modify and write PDF files from Java
https://products.aspose.com/pdf/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!