Skip to content

[#1557] Add BlazeCriteriaQuery.applyToCriteriaBuilder to allow using a JPA Criteria query as set operand#1659

Open
beikov wants to merge 1 commit into
Blazebit:mainfrom
beikov:issues/1557
Open

[#1557] Add BlazeCriteriaQuery.applyToCriteriaBuilder to allow using a JPA Criteria query as set operand#1659
beikov wants to merge 1 commit into
Blazebit:mainfrom
beikov:issues/1557

Conversation

@beikov
Copy link
Copy Markdown
Member

@beikov beikov commented Dec 29, 2022

Description

Related Issue

Fixes #1557

Motivation and Context

Copy link
Copy Markdown

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow BlazeCriteriaQuery to apply to a BaseCriteriaBuilder

1 participant