Enterprise Java Development@TOPIC@

Chapter 8. Criteria Functions

8.1. String Functions
8.1.1. Base Query
8.1.2. LOWER
8.1.3. UPPER
8.1.4. TRIM
8.1.5. CONCAT
8.1.6. LENGTH
8.1.7. LOCATE
8.1.8. SUBSTRING
8.2. Date Functions
8.3. Order By
8.4. Aggregate Functions
8.4.1. COUNT
8.4.2. MIN/MAX
8.4.3. SUM/AVE
8.5. Group By
8.6. Having
8.7. Summary




  • Located two Sales that occurred prior to today's date




  • Located no sales on today's date



  • Update all sales to today

JPA Criteria API does not Provide Bulk Updates

JPA provides no mechanism to perform bulk updates with Criteria API. You must use JPAQL or SQL to perform bulk updates.




  • Now locating sales for today's date

Note

Bulk commands (i.e., update) invalidate cached entities. You must refresh their state with the database or detach/clear them from the persistence context to avoid using out-dated information.




  • Note the ASC order on amount




  • Note the DESC order on amount



  • Get count of sales for each clerk




  • Provide a list of Clerks and their count of Sales for counts <= 1


  • Wed matched on Moe (1 sale) and Jack (0 sales)