Subquery in projections #1014

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

Comments

Projects
None yet
2 participants
@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

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Oct 26, 2014

Member

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

#1013

Member

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

This comment has been minimized.

Show comment
Hide comment
@fmamic

fmamic Oct 26, 2014

Yea, it works now. Thank you :)

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