Hi,
On Fri, May 5, 2017 at 12:53 AM, Steve Ebersole <steve_at_hibernate.org> wrote:
> Can definitely see the usefulness of this.
>
Thanks
> Whether it happens in this MR is a different question.
>
> I'd personally avoid exposing the SQL.
>
Sometimes it's a necessity for things that JPA just can't do. For instance,
JPA can't universally do a count over any random query, but in SQL this is
trivial (for most databases, that is).
For a longer explanation see:
http://arjan-tijms.omnifaces.org/2012/06/counting-rows-returned-from-jpa-query.html
Kind regards,
Arjan Tijms
> 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
>>
>>