Hibernate ResultTransformer with JPA API

Has anyone figured out a reasonable way to convert query results using the same mechanism as specifying ResultTransformer in Hibernate?

All I can imagine is converting each row of the result after it has been returned by Query. Is there another way?

For design projections (e.g. the new DTO (arg1, arg2)) it can be defined in a JPQL query, but what about other cases?

My usage example:

I am working on a custom Tuple projection for Querydsl , but I still can’t work fine with JPA. This is difficult with design projection, since I also need to provide query expressions, and not just the result values.

In general, other use cases may also be a JavaBean population (a public empty call to build and a collection-based collection) using the factory method to create an object, etc.

+3
source share
1 answer
+1
source

Source: https://habr.com/ru/post/1746062/


All Articles