how to transform result to map in hibernate5.2

670 views Asked by At

I'm using hibernate5.2 now.I want to transform result to map with native query, but setResultTransformer is deprecated.when i see the doc :@todo develop a new approach to result transformers in the method.so what is the new approach to result transformers with NativeQuery?

this is the code,and setResultTransformer() is deprecated in fact

 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();
0

There are 0 answers