This documentation chapter explains how to return non-managed entities for native queries. Is it possible for those entities to have collections of other non-managed entities?
In theory - yes. You can write your own result transformer (loosely based on org.hibernate.transform.AliasToBeanResultTransformer
) that would:
transformTuple()
method to transform 'root' bean along with a single collection element. transformList()
to merge collection elements into matching parent beans. In practice, however, it's much easier to actually map corresponding entities, even if you're only going to use it for retrieving the data from such a query.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.