Branch: refs/heads/main
Home:
https://github.com/hibernate/hibernate-orm
Commit: ebf06cc854443daeebe8b546cf4d9a869d691bf1
https://github.com/hibernate/hibernate-orm/commit/ebf06cc854443daeebe8b54...
Author: Davide D'Alto <davide(a)hibernate.org>
Date: 2025-01-31 (Fri, 31 Jan 2025)
Changed paths:
M
hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/AbstractSqmFrom.java
Log Message:
-----------
HHH-19034 Fix use of findCompatibleFetchJoin
The problem was that you had a different SQL query
depending on the order the fetch and join operations were
created when defining a criteria query.
For example:
```
// Example 1:
Root<Book> from = criteriaQuery.from( Book.class );
Fetch<Object, Object> fetch = from.fetch( "authors" );
Join<Object, Object> join = from.join( "authors" );
```
it was different than
```
// Example 2:
Root<Book> from = criteriaQuery.from( Book.class );
Join<Object, Object> join = from.join( "authors" );
Fetch<Object, Object> fetch = from.fetch( "authors" );
```
In the first example, `fetch` and `join` were exactly the
same object, causing issues if the association `authors` appeared
in the `where` clause. For example:
```
criteriaQuery.where( cb.equal( join.get( "id" ), 2L ) );
```
Note that now we always rung an extra join even when not necessary.
But this is consistent with what happen with HQL, and we can figure
out how to add this improvement in a different issue.
Commit: 92de056ce6099bab1c975830930686daf29722bb
https://github.com/hibernate/hibernate-orm/commit/92de056ce6099bab1c97583...
Author: Davide D'Alto <davide(a)hibernate.org>
Date: 2025-01-31 (Fri, 31 Jan 2025)
Changed paths:
A
hibernate-core/src/test/java/org/hibernate/orm/test/join/JoinAndFetchWithCriteriaSelectionQueryTest.java
Log Message:
-----------
HHH-19034 Test fetch and join order for Criteria
Compare:
https://github.com/hibernate/hibernate-orm/compare/1022e9ceeba5...92de056...
To unsubscribe from these emails, change your notification settings at
https://github.com/hibernate/hibernate-orm/settings/notifications