Skip to content

CXF-9174: Allow customization of JPA FIQL predicate building#2798

Open
raoua-eng wants to merge 5 commits intoapache:mainfrom
raoua-eng:CXF-9174-predicate-extension
Open

CXF-9174: Allow customization of JPA FIQL predicate building#2798
raoua-eng wants to merge 5 commits intoapache:mainfrom
raoua-eng:CXF-9174-predicate-extension

Conversation

@raoua-eng
Copy link

@raoua-eng raoua-eng commented Dec 23, 2025

This PR addresses CXF-9174.

It makes doBuildPredicate(...) and doBuildCollectionPredicate(...) protected to allow customization of predicate construction in JPACriteriaQueryVisitor.

A new test demonstrates how a custom visitor can override predicate behavior without duplicating the entire visitor implementation.

This enables use cases such as database-specific functions (e.g. accent-insensitive comparisons).

@raoua-eng
Copy link
Author

Hi @reta,
as discussed in CXF-9174, this PR opens up predicate customization by making the relevant methods protected and adds a test to demonstrate the extension mechanism.

Let me know if you'd like any adjustments.

@raoua-eng
Copy link
Author

@reta
The failure is unrelated to the PR changes.
The build fails during Maven extension resolution (maven-bundle-plugin / org.eclipse.sisu.inject) which points to a corrupted Maven repository or CI environment issue on Windows.

@reta
Copy link
Member

reta commented Dec 23, 2025

@reta The failure is unrelated to the PR changes. The build fails during Maven extension resolution (maven-bundle-plugin / org.eclipse.sisu.inject) which points to a corrupted Maven repository or CI environment issue on Windows.

Yeah, something is unstable, I will rerun checks shortly

@reta
Copy link
Member

reta commented Dec 23, 2025

@raoua-eng could you please fix checkstyle violations:

Error:  Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.2.2:checkstyle (validate) on project cxf-rt-rs-extension-search: An error has occurred in Checkstyle report generation. Failed during checkstyle execution: There are 85 errors reported by Checkstyle 12.3.0 with cxf-checkstyle.xml ruleset. -> [Help 1]

@raoua-eng
Copy link
Author

raoua-eng commented Dec 24, 2025

Fixed whitespace and tab character issues.
Line length trimmed to comply with style rules.

AbstractJPATypedQueryVisitor.java
@reta
Copy link
Member

reta commented Dec 24, 2025

Error: Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.2.2:checkstyle (validate) on project cxf-rt-rs-extension-search: An error has occurred in Checkstyle report generation. Failed during checkstyle execution: There are 83 errors reported by Checkstyle 12.3.0 with cxf-checkstyle.xml ruleset. -> [Help 1]

@raoua-eng could you please run mvn install -DskipTests=true -DskipITs=true locally? it will help you to catch issues, thank you

@raoua-eng
Copy link
Author

@reta I ran mvn install -DskipTests=true -DskipITs=true locally.
The remaining Checkstyle violations are in existing code and unrelated to the changes introduced by this PR.
Please let me know if you would still prefer me to address them in a separate commit.

@reta
Copy link
Member

reta commented Dec 24, 2025

The remaining Checkstyle violations are in existing code and unrelated to the changes introduced by this PR.

Thanks @raoua-eng , well, we cannot merge unless checks pass. If you are up to it, would be great to fix those, thank you

gnodet added a commit to gnodet/cxf that referenced this pull request Mar 10, 2026
Make doBuildPredicate and doBuildCollectionPredicate methods protected
in AbstractJPATypedQueryVisitor to allow subclasses to customize
predicate construction for specific properties or collection checks.

Add getEntityManager() accessor to AbstractJPATypedQueryVisitorTest
and new test classes demonstrating the extension capability.

Based on PR apache#2798 by mkarg, with fixes for checkstyle compliance
(tabs to spaces, import ordering) and corrected test assertions.
gnodet added 2 commits March 10, 2026 17:45
- Convert tabs to spaces in new test files
- Fix import ordering (static imports at bottom per CXF convention)
- Use path.getModel() instead of path.getAlias() for attribute
  identification (getAlias() returns null for JPA paths)
- Use case-insensitive LIKE in custom visitor test
- Fix collection predicate test to use count() syntax that actually
  triggers the collection check path
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.

3 participants