From the course: Java Persistence API (JPA): 2 Inheritance and Querying

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Create simple queries with JPQL syntax

Create simple queries with JPQL syntax

From the course: Java Persistence API (JPA): 2 Inheritance and Querying

Start my 1-month free trial

Create simple queries with JPQL syntax

- [Instructor] Let's learn about JPQL syntax, writing dynamic queries, and the pros and cons of using dynamic queries to retrieve data. JPQL syntax is very similar to the syntax of SQL. The syntax of the select query consists of two mandatory parts, the select and the from clause. Select defines the format of the query result. The from clause defines the entity or entities from which the results will be obtained. Then we have the optional where, order by, group by, and having clauses that can be used to restrict or order the results of the query. Delete and update statements can also be used to perform delete and update operations across multiple instances, but I will only focus on select queries for this course. We can apply functions on select statements such as average, count, max, min, or sum. There are also operators that we can expect from a query language such as equal, less than, less than or equal, between, not between, and so on. When it comes to expressions on types, there…

Contents