You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Raoua KHATERCHI (Jira)" <ji...@apache.org> on 2025/12/23 10:03:00 UTC

[jira] [Commented] (CXF-9174) Allow overriding buildPredicate in JPACriteriaQueryVisitor for custom predicates

    [ https://issues.apache.org/jira/browse/CXF-9174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18047220#comment-18047220 ] 

Raoua KHATERCHI commented on CXF-9174:
--------------------------------------

A pull request has been opened to address this issue: [https://github.com/apache/cxf/pull/2798]

The PR makes {{doBuildPredicate}} and {{doBuildCollectionPredicate}} protected and adds tests demonstrating predicate customization through visitor subclassing.

Feedback is very welcome.

> Allow overriding buildPredicate in JPACriteriaQueryVisitor for custom predicates
> --------------------------------------------------------------------------------
>
>                 Key: CXF-9174
>                 URL: https://issues.apache.org/jira/browse/CXF-9174
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>    Affects Versions: 4.1.3
>         Environment: * Apache CXF 4.0.4
>  * {{cxf-rt-rs-extension-search}}
>  * Jakarta Persistence ({{{}jakarta.persistence{}}})
>            Reporter: Raoua KHATERCHI
>            Priority: Major
>             Fix For: 4.1.5, 3.6.10, 4.0.11
>
>
> I am using Apache CXF 4.0.4 with {{cxf-rt-rs-extension-search}} for building JPA Criteria queries via {{{}JPACriteriaQueryVisitor{}}}. Currently, the class {*}does not allow overriding or extending the {{buildPredicate}} logic{*}, because:
>  # The method {{buildPredicate(PrimitiveStatement ps)}} in {{AbstractJPATypedQueryVisitor}} is {*}private{*}, making it impossible to customize predicate generation.
>  # There is no protected or public extension point to apply custom transformations, such as accent-insensitive search, normalization of fields, or other domain-specific predicate logic.
> This limitation prevents extending CXF's FIQL/JPA Criteria integration for advanced use cases like accent-insensitive filtering in a way that works across Oracle and PostgreSQL.
> *Expected behavior:*
> Provide either:
>  * {{buildPredicate}} or similar method as *protected* in {{AbstractJPATypedQueryVisitor}} so it can be overridden, or
>  * A clear extension point in {{JPACriteriaQueryVisitor}} to allow customization of predicate generation without copying the entire class.
> This will allow developers to implement custom filtering logic (e.g., unaccented search, normalization) in a maintainable way without modifying CXF core classes.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)