Skip to content

Comments

additional overload of CriteriaBuilder.between()#690

Open
henriquediascampos wants to merge 4 commits intojakartaee:masterfrom
henriquediascampos:between-value-expression-expression-specification
Open

additional overload of CriteriaBuilder.between()#690
henriquediascampos wants to merge 4 commits intojakartaee:masterfrom
henriquediascampos:between-value-expression-expression-specification

Conversation

@henriquediascampos
Copy link

Recently, I noticed the absence of a Predicate specification that tests whether a given literal value v is between two dynamic expressions x and y.

In a real-world scenario, I encountered this need while checking if a specific date fell between two values stored in the database. At the time, I worked around this by combining "greater than" and "less than" conditions to achieve the desired result. However, wouldn't it be much cleaner and less verbose if we could express this condition directly in a clearer way?

This addition introduces a new between method that improves query readability and conciseness. I believe this enhancement would make the API more intuitive for developers who encounter similar use cases.

(This is my first contribution; please let me know if I missed any steps or if further adjustments are needed. I appreciate your feedback!)

@henriquediascampos henriquediascampos force-pushed the between-value-expression-expression-specification branch from 3f423eb to 37f2bb2 Compare December 17, 2024 16:47
Copy link
Member

@gavinking gavinking left a comment

Choose a reason for hiding this comment

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

I have no objection to adding this.

@gavinking
Copy link
Member

@henriquediascampos You need to update the file header as so:

f3f4a4c

@gavinking gavinking changed the title adding the "between" specification to make queries easier additional overload of CriteriaBuilder.between() Nov 23, 2025
@gavinking
Copy link
Member

Also probably best to have an issue.

@gavinking gavinking added the candidate-for-4 Good candidate for JPA 4 label Nov 23, 2025
@henriquediascampos
Copy link
Author

@gavinking If you could help me with a question.
Should I still make the changes you requested?
I got a bit confused because I noticed you already pushed a commit (f3f4a4c) fixing what I had missed.
This is my first contribution, so I’m still a bit confused.

@gavinking
Copy link
Member

I got a bit confused because I noticed you already pushed a commit

I can't push to your branch though.

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

Labels

candidate-for-4 Good candidate for JPA 4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants