开发者

Hibernate ResultTransformer with JPA API

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 worki开发者_运维问答ng 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.


It is possible with EclipseLink JPA implementation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜