[#1557] Add BlazeCriteriaQuery.applyToCriteriaBuilder to allow using a JPA Criteria query as set operand#1659
[#1557] Add BlazeCriteriaQuery.applyToCriteriaBuilder to allow using a JPA Criteria query as set operand#1659beikov wants to merge 1 commit into
Conversation
…w using a JPA Criteria query as set operand
There was a problem hiding this comment.
It would be super helpful if this apply functionality was available more generically. I have a requirement to support a filter on an analytic function - but these window functions aren’t supported in the where clause. The work around is either a select from a CTE or a sub query. It would be helpful if you already have a criteria query to be able to pass it into a fromWith or fromSubquery. So we end up with either:
select * from (…) a where a.rank = 1
or
with a as (…) select * from a where a.rank =1
In this example rank is a window function in the CTE or sub query of the form “rank() over (partition by … order by …) as rank”
When you already have a JPA criteria query but simply wish to wrap it in a parent select like above, I cannot see an easy way to achieve this without rebuilding the whole query from scratch using the BlazeCriteriaBuilder. Any help appreciated on this request!
thanks - d
Description
Related Issue
Fixes #1557
Motivation and Context