Can definitely see the usefulness of this. Whether it happens in this MR
is a different question.
I'd personally avoid exposing the SQL. I'd also suggest adding a note that
getting the JPQL from a Query and especially from a criteria query is a
potentially expensive operation, for those considering using it in a
toString e.g.
On Thu, May 4, 2017, 5:27 PM arjan tijms <arjan.tijms_at_gmail.com> wrote:
> 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
> <http://java.net/jira/browse/JPA_SPEC-29>*"
>
> Wonder if this could be considered for the MR.
>
> Kind regards,
> Arjan Tijms
>
>