概述
Java Persistence Query Language
基於首次在EJB2.0中引入的EJB查詢語言(EJB QL),Java持久化查詢語言(JPQL)是一種可移植的查詢語言,旨在以面向對象表達式語言的表達式,將SQL語法和簡單查詢語義綁定在一起.使用這種語言編寫的查詢是可移植的,可以被編譯成所有主流數據庫伺服器上的SQL.
選擇查詢
SELECT <select_expression>
FROM <from_clause>
[WHERE <conditional_expression>]
[ORDER BY <order_by_clause>]
聚合查詢
SELECT <select_expression>
FROM <from_clause>
[WHERE <conditional_expression>]
[GROUP BY <group_by_clause>]
[HAVING <conditional_expression>]
[ORDER BY <order_by_clause>]
更新查詢
UPDATE <entity name>[ [AS ] <identification variable>]
SET <update_statement>{,<update_statement>}*
[WHERE <conditional_expression>]
刪除查詢
DELETE FROM <entity name>[ [AS ] <identification variable>]
[WHERE <conditional_expression>]