users@jpa-spec.java.net

[jpa-spec users] Re: JPA_SPEC-25: map back and forth between CriteriaQueries and JPQL queries

From: Oliver Gierke <ogierke_at_pivotal.io>
Date: Fri, 5 May 2017 08:33:01 +0200

Hi Arjan,

I'd like to cast some light on that subject from a "framework user" point of view. Support like that would definitely be helpful as we in Spring Data JPA face the requirement that a user might want to declare a query in general but augment it with sorting expression dynamically. We currently fall back on provider specific API to extract the query string [0]. Applying a count-projection onto a user-defined query is a big use case for our pagination support, again relying on the same mechanism.

However, we mostly need access to the JPQL query currently.

Cheers,
Ollie

[0] https://github.com/spring-projects/spring-data-jpa/blob/d9a08871dbca22ade575929d7254ff7047b22a0e/src/main/java/org/springframework/data/jpa/provider/PersistenceProvider.java#L68-L70

> Am 05.05.2017 um 00:27 schrieb arjan tijms <arjan.tijms_at_gmail.com>:
>
> Hi,
>
> See https://java.net/jira/browse/JPA_SPEC-25
>
> This would be an incredible useful feature to have and largely would "just" be exposing methods that all persistence providers already seem to have internally.
>
> Linda herself said:
>
> "Being able to map back and forth between CriteriaQueries and JPQL queries would be useful to have. This is something that should be considered in a future release. See also http://java.net/jira/browse/JPA_SPEC-29"
>
> Wonder if this could be considered for the MR.
>
> Kind regards,
> Arjan Tijms
>