If you are unfamiliar with the query language, these simple queries are a good place to start.
SELECT p FROM Player p
Data retrieved: All players.
Description: The FROM clause declares an identification variable named p, omitting the optional keyword AS. If the AS keyword were included, the clause would be written as follows:
FROM Player AS p
The Player element is the abstract schema name of the Player entity.
See also: Identification Variables
SELECT DISTINCT p FROM Player p WHERE p.position = ?1
The WHERE clause restricts the players retrieved by checking their position, a persistent field of the Player entity. The ?1 element denotes the input parameter of the query.
SELECT DISTINCT p FROM Player p WHERE p.position = :position AND p.name = :name
Data retrieved: The players having the specified positions and names.
Description: The position and name elements are persistent fields of the Player entity. The WHERE clause compares the values of these fields with the named parameters of the query, set using the Query.setNamedParameter method. The query language denotes a named input parameter using colon (:) followed by an identifier. The first input parameter is :position, the second is :name.