SQLExpressions.unionAll returns "No connection provided" #2068

pvanhon1 opened this Issue Dec 19, 2016 · 0 comments


None yet

1 participant

pvanhon1 commented Dec 19, 2016 edited

using querydsl version 4.1.4

The connection info is not filled in when using SQLExpressions.unionAll.

JPAQueryFactory queryFactory = new JPAQueryFactory(entityManager);
JPAQuery jpaQuery1 = queryFactory.select(Expressions.constant("abc"), QAlertOverview.alertOverview.alertId.count()).from(QAlertOverview.alertOverview);
JPAQuery jpaQuery2 =  queryFactory.select(Expressions.constant("def"), QAlert.alert.id.count()).from(QAlert.alert);
List list1 = jpaQuery1. fetch();
List list2 = jpaQuery2. fetch();
List list1and2 = SQLExpressions.unionAll(jpaQuery1, jpaQuery2).fetch();

The fetch of list1 and list2 work correctly while fetch of list1and2 throw "java.lang.IllegalStateException: No connection provided", which is logical since SQLExpressions.unionAll does not copy connection info;

What's the correct way of executing the unionized query?

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