'Hibernate 6: What is SQM?

In the Hibernate 6.0 Roadmap (https://github.com/hibernate/hibernate-orm/wiki/Roadmap6.0) SQM is mentioned as upcoming.

What is SQM?

In this roadmap the following short words describe it:

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.

This is all I've found about SQM. Could someone please explain it a little more in detail? What exactly is it, how will it look like when it comes to coding, which benefits will it have?



Solution 1:[1]

SQM stands for Semantic Query Model, and it is the new entity query parser that addresses both JPQL and Criteria API.

Hibernate SQM

The new parser is much more flexible, and it provides better SQL translation of entity queries.

From a user perspective, SQM provides more features like Window Functions, CTE (Common Table Expressions), Lateral Joins, etc.

SQM provides better performance as well since Criteria API is parsed directly to SQL.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1