Skip to content
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

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

beikov
Copy link
Member

@beikov beikov commented Dec 29, 2022

Description

Related Issue

Fixes #1557

Motivation and Context

Copy link

@donalpmccarthy donalpmccarthy 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
2 participants