paulk-asert commented on PR #315: URL: https://github.com/apache/openjpa/pull/315#issuecomment-7050660618
> Thanks, looks good. One gap per JPA 3.2 section 4.2.1 (set operators): every operand is a full select_query, so it may use a constructor expression, and a provider must support it when corresponding items have exactly the same type, which for a constructor expression is the constructed class. resultClass of the first operand is not copied onto the compound, and ExpressionStoreQuery.getResultClass() reads it from the compound, so "SELECT NEW Dto(a.name) FROM Author a UNION SELECT NEW Dto(g.label) FROM Gadget g" should come back as raw rows instead of Dto instances. Could you copy resultClass as well and add a test? > > Criteria set operations (CriteriaSelectImpl.getQueryExpressions) build the compound the same way and do not get the projections, so cb.union(...) with scalar selections probably still has the issue. I opened https://issues.apache.org/jira/browse/OPENJPA-3092 for that. Good catch, thanks. I can add another commit here or do it as a follow-up PR once this one is merged. Do you have a preference? I have a local change that copies the existing shape as well as resultClass, since a constructor mixed with other selections (SELECT NEW Dto(..), x) is packed through the shape and would otherwise come back as raw columns. The test covers both cases, typed and untyped, and repeated execution. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
