Java Persistence Query Language Flashcards

1
Q

JPA

A

Java Persistence API

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

JP QL

A

Java Persistence Query Language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Object keyword

A

The keyword OBJECT can be used to indicate that the result type of the query is the entity bound to the identification variable. It has no impact on the query, but it can be used as a visual clue.

The syntax of the OBJECT keyword is limited to identification variables.

Supported for backward compatibility.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is “projection” wrt JP QL?

A

The practice of reporting only a subset of the state fields from an entity is called projection.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are “Constructor Expressions”.

A

Constructor Expressions are a form of the SELECT clause involving multiple expressions is the constructor expression, which specifies that the results of the query are to be stored using a user-specified object type.

The result object type must be referred to by using the fully qualified name of the object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Identification Variables

A

The identification variable is the starting point for all query expressions. Every query must have at least one identification variable defined in the FROM clause, and that variable must correspond to an entity type.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Range Variable declaration

A

When an identification variable declaration does not use a path expression (that is, when it is a single entity name), it is referred to as a range variable declaration.

Range variable declarations use the syntax < entity_name > [AS] < identifier>.

identifier is case insensitive.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

When does a join occur in JP QL?

A

Joins occur whenever any of the following conditions are met in a select query.

<ul>
<li>Two or more range variable declarations are listed in the FROM clause and appear in the select clause.</li>
<li>The JOIN operator is used to extend an identification variable using a path expression. </li>
<li>A path expression anywhere in the query navigates across an association field, to the same or a different entity. </li>
<li>One or more WHERE conditions compare attributes of different identification variables.</li>
</ul>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Inner Join

A

An inner join between two entities returns the objects from both entity types that satisfy all the join conditions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Cartesian product.

A

Cartesian products are rare with JP QL queries given the navigation capabilities of the language, but they are possible if two range variable declarations in the FROM clause are specified without additional conditions specified in the WHERE clause.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is downcasting?

A

Downcasting is the technique of making an expression that refers to a superclass be applied to a specific subclass . It is achieved through the use of the TREAT operator.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly