Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subquery in projections #1014

Closed
fmamic opened this issue Oct 26, 2014 · 2 comments
Closed

Subquery in projections #1014

fmamic opened this issue Oct 26, 2014 · 2 comments
Milestone

Comments

@fmamic
Copy link

@fmamic fmamic commented Oct 26, 2014

Hello,
I have a query with projection and i need to use subquery to count team matches.

QMatch qMatch = QMatch.match;
QTeam qTeam = QTeam.team;

query.from(qMatch).where(builder)
                .groupBy(queryStringPath).list(
                Projections.constructor(TeamResultDto.class,
                        new JPASubQuery().from(qTeam).where(qTeam.name.eq(qMatch.homeTeam.name)).count(),
                        queryStringPath, qMatch.homeTeam.name.count())
        ); 

I get :

java.lang.IllegalArgumentException: Undeclared path 'match'. Add this path as a source to the query to be able to reference it.

Referencing from where/from part of query is ok, but when i try to use qMatch in my projection it doesn't work.

@timowest
Copy link
Member

@timowest timowest commented Oct 26, 2014

@fmamic Thanks for the bug report! Could you take a look at this pull request and try it also on your query?

#1013

@fmamic
Copy link
Author

@fmamic fmamic commented Oct 26, 2014

Yea, it works now. Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.