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

JPQLQuery loses nulls last/first for nested properties #1503

arivi opened this Issue Aug 28, 2015 · 1 comment


None yet
2 participants

arivi commented Aug 28, 2015

I'm trying to generate a JPQLQuery which is order by a field in nested property. So I do something like this:


And the relevant part in the resulting sql looks like this:

order by devic1_.connection_time desc  

So the nulls last is missing.

Looking at my debugger, I can see that the place where the null handling value is reset is the -class.

public final T orderBy(OrderSpecifier<?> spec) {
        Expression<?> e = convert(spec.getTarget(), true);
        if (!spec.getTarget().equals(e)) {
            metadata.addOrderBy(new OrderSpecifier(spec.getOrder(), e));
        } else {
        return self;

It seems that after the conversion, the first branch gets chosen and there is a call to the two argument OrderSpecifier -constructor that looks like this:

public OrderSpecifier(Order order, Expression<T> target) {
        this(order, target, NullHandling.Default);        

So much for my nulls last then.. Shouldn't the orderBy -method in the QueryMixin -class also copy the null handling value over to the new OrderSpecifier?


This comment has been minimized.

Show comment
Hide comment

timowest Aug 28, 2015


Thanks for the bug report! Fixed for Querydsl 3 and 4.


timowest commented Aug 28, 2015

Thanks for the bug report! Fixed for Querydsl 3 and 4.

@timowest timowest added the progress label Aug 29, 2015

@johnktims johnktims closed this in #1504 Aug 31, 2015

@timowest timowest added this to the 4.0.4 milestone Aug 31, 2015

@timowest timowest removed the progress label Aug 31, 2015

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