Using the Where clause

The Where clause is used to narrow down the number of entities handled by a query. In the case of the Select statement, it determines the number of entities returned. With a Delete statement it determines which entities will be removed from a table.

The Where clause uses a number of operators to control which entities will be affected. In this recipe we will illustrate how many of them are used.

Getting ready

The Where clause consists of the WHERE keyword followed by a conditional expression. The conditional expression determines which entities are affected by the query. The Where clause is optional and if omitted will identify all of the entities in a table. If it is present, only those entities matching the conditional expression ...

Get EJB 3.1 Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.