JPA Criteria SELECT ClauseThe SELECT clause is used to fetch the data from database. The data can be retrieved in the form of single expression or multiple expressions. In Criteria API, each form is expressed differently. Criteria SELECT ExampleGenerally, select() method is used for the SELECT clause to fetch all type of forms. Here, we will perform several SELECT operations on student table. Let us assume the table contains the following records: - ![]() Now, follow the below steps to perform operations: -
StudentEntity.java
Persistence.xml
Selecting Single Expression Here, we will fetch single column from database with the help of a simple example. SingleFetch.java Output: ![]() Selecting Multiple Expression Here, we will fetch multiple columns from database with the help of a simple example. MultiFetch.java Output: ![]()
Next TopicJPA ORDER BY Clause
|