Steven5007

导航

Hibernate5.0 EntityManager转SqlQuery并返回Map结果集

Hibernate5.0 EntityManager转SqlQuery并返回Map结果集

Query query = entityManager.createNativeQuery("select * from message");
query.unwrap(org.hibernate.SQLQuery.class)
.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);

List<Map<String, Object>> list = query.getResultList()

posted on 2019-12-09 18:11  Steven5007  阅读(529)  评论(0编辑  收藏  举报