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

Issue with using select when using a union #842

Closed
PipoAno opened this issue Jul 10, 2014 · 2 comments
Closed

Issue with using select when using a union #842

PipoAno opened this issue Jul 10, 2014 · 2 comments
Labels
bug
Milestone

Comments

@PipoAno
Copy link

@PipoAno PipoAno commented Jul 10, 2014

I am having an issue with queryDSL when using a union clause. For instance in the following example

Expression selectExpression new Expression<?>[] {
                pathToField1,
                pathToField2,
                pathToField3
}
ListSubQuery<Tuple> firstQuery = ...........
ListSubQuery<Tuple> secondQuery = .............
query.union(firstQuery, secondQuery);
query.iterate(selectExpression);

The order of the pathToField items in the selectExpression does not seem to affect the order in the which the fields actually come out in the tuple. There seems to be no way to actually change this order via a select. In the SQL output from the query build process, there is no select clause preceeding the union clause.

@timowest timowest added the bug label Jul 10, 2014
@timowest
Copy link
Member

@timowest timowest commented Jul 11, 2014

If you need to reorder the fields in the union result you will need to provide an alias for the union expression. That would be in your case the root path of e.g. pathToField1:

query.union(rootPath, firstQuery, secondQuery);
query.iterate(selectExpression);
@timowest timowest removed the bug label Jul 11, 2014
@PipoAno PipoAno closed this Jul 12, 2014
@PipoAno PipoAno reopened this Jul 12, 2014
@timowest timowest added the bug label Jul 13, 2014
@timowest timowest added the fixed label Jul 13, 2014
@timowest timowest modified the milestone: 3.4.2 Jul 13, 2014
@timowest timowest removed the fixed label Jul 19, 2014
@timowest timowest closed this Jul 19, 2014
@timowest
Copy link
Member

@timowest timowest commented Jul 29, 2014

Released in 3.4.2

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.

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