how to transform result to map in hibernate5.2
Asked Answered
P

0

8

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();
Presnell answered 15/12, 2016 at 3:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.