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?
This documentation chapter explains how to return non-managed entities for native queries. Is it
Share
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.