Java – hibernate – native SQL unmanaged entity collection

This documentation chapter explains how to return unmanaged entities for native queries Is it possible for these entities to own a collection of other non managed entities?

Solution

Theoretically – yes You can write your own result transformer (loosely based on org.hibernate.transform.aliastobeanresulttransformer), which will:

>Use the transformtuple() method to convert the "root" bean together with a single collection element. > Then use transformlist () to merge the collection elements into the matching parent bean

In practice, however, it is much easier to actually map the corresponding entity, even if you just use it to retrieve data from such queries

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>