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

Support for CTE's for JPA Criteria API integration #960

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

jwgmeligmeyling
Copy link
Collaborator

@beikov I had to do quite some heavy work on the CTE criteria interface structure. I decided to stay close to the criteria builder API. Some interfaces are yet unnecessary, but will become important if we start adding set operations, which should not be available in i.e. recursive CTEs.

I ported two tests from the existing CTETest (one partially) as a proof of concept for the CTE api. The API is very much based on the existing criteria API - which is not particularly fluent. I'll see how the fluency of the API can be improved by additional extensions/helpers after we have more of the puzzle pieces together.

Please review the general structure before I proceed.

Description

Related Issue

Motivation and Context

@beikov
Copy link
Member

beikov commented Dec 29, 2019

Looks good so far, but I wonder what would happen if a path created via a CTE query would be used somewhere othe than for a binding. Due to this, I'd rather not expose the path directly.
Also, in general, I think we should first think about a way to do set operations for the JPA Criteria API and then see how we can make recursive CTEs work with that.

@jwgmeligmeyling
Copy link
Collaborator Author

Looks good so far, but I wonder what would happen if a path created via a CTE query would be used somewhere othe than for a binding. Due to this, I'd rather not expose the path directly.

Hmm. It's still technically a Path however, just not a Path that references any of the query roots. I'd rather just throw an exception if we detect a Path that references an unreferenced query root. This allows us to keep the API analog to how modification queries work which I think is important.

Also, in general, I think we should first think about a way to do set operations for the JPA Criteria API and then see how we can make recursive CTEs work with that.

Recursive CTE's don't support set operations through the SetBuilder though (It does via the SelectRecursiveCTECriteriaBuilder), only the FullSelectCTECriteriaBuilder does implement SetBuilder. I think the implementation of recursive CTE's is going to be similar but separate from set operations. I am working on a POC for set operations now.

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.

2 participants