0% found this document useful (0 votes)
5 views6 pages

JPQL (Java Persistence Query Language)

The document consists of a series of true/false questions related to binding parameters, JPQL, and query statements in JPA. All answers provided are marked as true, indicating the correctness of the statements regarding the functionalities and characteristics of queries. Key concepts include positional and named parameters, the use of primary keys, and the differences between JPQL and SQL.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views6 pages

JPQL (Java Persistence Query Language)

The document consists of a series of true/false questions related to binding parameters, JPQL, and query statements in JPA. All answers provided are marked as true, indicating the correctness of the statements regarding the functionalities and characteristics of queries. Key concepts include positional and named parameters, the use of primary keys, and the differences between JPQL and SQL.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Question 1

There are two ways of applying binding parameters, namely:


Positional and named parameters.

Question 1 options:
a) True
b) False

Answer: True

Question 2

Criteria API uses queries that are object-oriented.

Question 2 options:
a) True
b) False

Answer: True

Question 3

Binding parameters is used when a method needs dynamic values from the user
to create a query statement.

Question 3 options:

a) True
b) False

Answer: True

Question 4
Named queries use static query strings

Question 4 options:
a) True
b) False

Answer: True

Question 5

The following statement counts the number of customers whose age is above 50.

SELECT COUNT(c) FROM Customer c WHERE c.age > 50

Question 5 options:
a) True
b) False
Answer: True

Question 6

Named queries use dynamic query strings.

Question 6 options:
a) True
b) False

Answer: False

Question 7

Native queries use normal SQL statements.

Question 7 options:
a) True
b) False

Answer: True

Question 8

Dynamic queries use dynamic strings that are processed at runtime.

Question 8 options:
a) True
b) False

Answer: True

Question 9

The syntax used to represent named parameters is the colon (:) symbol followed
by the name given to the parameter.

Question 9 options:
a) True
b) False

Answer: True

Question 10
Through JPA we are able to create records, read them, update, and delete. But all
these functionalities require the invocation of the primary key. Without the
primary key we can’t find a record, nor update it.

Question 10 options:
a) True
b) False

Answer: True

Question 11

The following statement deletes all customers whose age is above 50:

DELETE FROM Customer c WHERE c.age > 50

Question 11 options:
a) True
b) False

Answer: True

Question 12
Through JPQL we can create customized query statements without involving the
primary key.

Question 12 options:
a) True
b) False

Answer: True

Question 13
Positional parameters work with the position of a parameter in a query. The
syntax used to represent positional parameters is ? followed by a number.

Question 13 options:
a) True
b) False

Answer: True

Question 14

The following statement changes the age of Jabu to 10.

UPDATE Customer c

SET c.age = 10
WHERE c.name = ‘Jabu’

Question 14 options:
a) True
b) False

Answer: True

Question 15

JPQL stands for Java Persistence Query Language.

Question 15 options:
a) True
b) False

Answer: True

Question 16

Binding parameters is a mechanism of binding user given values to query


statements.

Question 16 options:
a) True
b) False

Answer: True

Question 17
The only difference between JPQL and SQL is that JPQL is object-oriented.

Question 17 options:
a) True
b) False

Answer: True..

Question 18
The following statement gets all the customers whose age is between 20 and 30,
both values inclusive.

SELECT c FROM Customer c WHERE c.age >= 20 AND c.age <=30

Question 18 options:
a) True
b) False

Answer: True

Question 19

The following statement selects all the customers from the table called
Customer.

SELECT c FROM Customer c

Question 19 options:
a) True
b) False

Answer: True

Question 20

JPQL is similar to SQL.

Question 20 options:
a) True
b) False

Answer: True

Question 21

Named parameters use names to position a parameter in the query statement.

Question 21 options:
a) True
b) False

Answer: True..

Question 22

There are four ways of creating queries in JPQL, namely:

Dynamic queries;
Named queries;
Native queries; and
Criteria queries.

Question 22 options:
a) True
b) False
Answer: True

You might also like