Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 819
olivmir Avatar asked Sep 26 '18 13:09

olivmir


People also ask

What is new in Hibernate 6?

Significant new features include a migration to the Jakarta Persistence 3.0 specification, performance improvements to JDBC, and HQL translation and criteria translation. With this release, Hibernate requires a minimum of Java 11.


1 Answers

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.

like image 90
Vlad Mihalcea Avatar answered Oct 02 '22 13:10

Vlad Mihalcea