Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Transforming result set with JPA

807580Aug 13 2009 — edited Aug 14 2009
Hi,

I am currently trying to migrate a system with Hibernate persistence layer to JPA.
With Hibernate it is possible to transform result set of native or custom queries to particular non-managed value object, thus skipping boilerplate conversion and multiple setter invocations:
sqlQuery.setResultTransformer(Transformers.aliasToBean(SomeSimpleDTO.class));
The question is, how it is possible to do something similar with JPA?
I know that it is possible to use SqlResultSetMapping annotation to map particular aliases with particular properties, however, I have read that this annotation works only with managed entities, but not with non-managed DTOs. Is this true? If yes, does JPA have similar functionality?

Thank you.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 11 2009
Added on Aug 13 2009
4 comments
383 views