views:

258

answers:

0

Has anyone figured out a smart way to do query result transformation through a similar mechanism like specifying a ResultTransformer in Hibernate?

All I can think of is transforming each result row after it has been returned by the Query. Is there any other way?

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

My use case is the following :

I am working on a custom Tuple projection for Querydsl, but I can't yet get it working properly with JPA. It is difficult with constructor projection, since I also need to supply the query expressions, not only the result values.

In general other use cases could also be JavaBean population (public empty construction invocation and setter-based population), using a factory method for object creation etc.