Hibernate 6:什么是 SQM?

Hibernate 6: What is SQM?

在 Hibernate 6.0 路线图 (https://github.com/hibernate/hibernate-orm/wiki/Roadmap6.0) 中提到 SQM 即将推出。

什么是 SQM?

在此路线图中,以下简短词语对其进行了描述:

SQM integration: Improved performance for SQL generation and execution (smaller SQL, position-based extraction of results rather than name(alias)-based); Unified approach for HQL, JPQL and Criteria queries.

这就是我对 SQM 的全部了解。有人可以更详细地解释一下吗?它到底是什么,在编码方面会是什么样子,它有哪些好处?

SQM代表语义查询模型,它是同时解决JPQL和Criteria的新实体查询解析器API.

新的解析器更加灵活,它提供了更好的 SQL 实体查询翻译。

从用户的角度来看,SQM 提供了更多功能,例如 Window 函数、CTE(通用 Table 表达式)、横向连接等

SQM 也提供更好的性能,因为条件 API 直接解析为 SQL。