Branch: refs/heads/6.6
Home:
https://github.com/hibernate/hibernate-orm
Commit: 6a3ef4bb75edf11366db281b5b3224ffa9e80087
https://github.com/hibernate/hibernate-orm/commit/6a3ef4bb75edf11366db281...
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: 879c56b4a2ab6bccd53caab1e28b00504a5752ee
https://github.com/hibernate/hibernate-orm/commit/879c56b4a2ab6bccd53caab...
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/ff8ebd5931f9...879c56b...
To unsubscribe from these emails, change your notification settings at
https://github.com/hibernate/hibernate-orm/settings/notifications