How to convert result to map in hibernate5.2

I am using hibernate5.2 now. I want to convert the result to a map using my own query, but setResultTransformer deprecated. When I see the document: @todo develop a new approach to result transformers in the .so method what is the new approach to result transformers with NativeQuery?

this is code, and setResultTransformer () is actually deprecated

  NativeQuery nativeQuery = session.createNativeQuery(sql); for (int i = 0; i < params.length; i++) { nativeQuery.setParameter(i, params[i]); } List res = nativeQuery.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).list(); 
+5
source share

Source: https://habr.com/ru/post/1261305/


All Articles