Subquery in 'where' clause causes additional 'join' creation in SQM

Description

When you create a subquery on entity which is joined then additional inner join is created in SQM query.

Entities:

 

Query creation:

 

In the first query we receive following result:

There’s the additional inner join to c2_0, which is never used.

 

In the second query this is the result:

There are not additional joins.

 

First query with Hibernate 5.6.15:

It doesn’t have any additional inner join.

 

Test case -

I have created same test case in orm-5 and orm-6. In orm-5 it works and it fails in orm-6.

Activity

Show:

Marco Belladelli August 11, 2023 at 12:30 PM

Hi , thank you for reporting the issue and providing a reproducer.

This error has already been fixed by . I will still add your case to Hibernate’s test suite to make sure we continue supporting this correctly.

Fixed

Details

Assignee

Reporter

Worked in

Components

Sprint

Fix versions

Affects versions

Priority

Created July 12, 2023 at 12:20 PM
Updated August 11, 2023 at 12:31 PM
Resolved August 11, 2023 at 12:31 PM
Loading...