标签:str persist creat result ali protected factory ati 返回
public class Test(){ @PersistenceContext(unitName = "manageFactory") protected EntityManager em; public List<Map<String, Object>>getListMap(String sql){ Query nativeQuery=em.createNativeQuery(sql); nativeQuery.unwrap(NativeQueryImpl.class).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP); List resultList=nativeQuery.getResultList(); return resultList; } }
jpa返回List<Map<String, Object>>相当于jdbctemplate的queryForlist
标签:str persist creat result ali protected factory ati 返回
原文地址:https://www.cnblogs.com/zqr99/p/9057533.html