Skip to content

[#1644] Fix incorrect projection extraction for subqueries (use join …#2108

Open
kamilkrzywanski wants to merge 1 commit intoBlazebit:mainfrom
kamilkrzywanski:issue/1644
Open

[#1644] Fix incorrect projection extraction for subqueries (use join …#2108
kamilkrzywanski wants to merge 1 commit intoBlazebit:mainfrom
kamilkrzywanski:issue/1644

Conversation

@kamilkrzywanski
Copy link
Copy Markdown

Description

Fix incorrect projection extraction for subqueries (use join target when projection is null) (default projection is root entity from first join)

Related Issue

#1644

I didn't write tests because there is no place where I could test Querydsl + views

…se join target when projection is null) (default projection is root entity from first join)
}

return firstJoin.getType() == com.querydsl.core.JoinType.DEFAULT
? Projections.constructor(firstJoin.getTarget().getType())
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a convenience (desugar) or query language feature? The PR is suggested as a fix but what states that subqueries without a projection were ever allowed in JPQL/JPQL Next?

Doing this kind of expression manipulation makes a few assumptions that may not always be true:

  • The entity is a class
  • The entity name is the classname
  • The entity name is the alias for the select expression

Please add a test case to https://github.com/Blazebit/blaze-persistence/blob/main/integration/querydsl/testsuite/src/test/java/com/blazebit/persistence/querydsl/BasicQueryTest.java so we can have a look that the desired query behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants