Hibernate - createNativeQuery with “non-entity class” result

前端 未结 6 1875
清酒与你
清酒与你 2021-01-04 20:13

I\'m new to all this Hibernate/JPA stuff, so i will try to be as clear as possible.

Is there any way in Hibernate to use createNativeQuery to select a single/or mult

6条回答
  •  离开以前
    2021-01-04 20:43

    For Hibernate 5.0

    Query query = getEntityManager().createNativeQuery(sql);
    List objects = query.getResultList();
    System.out.println(objects.get(0)[0]);
    

    https://docs.jboss.org/hibernate/orm/5.0/userguide/html_single/chapters/query/native/Native.html

提交回复
热议问题