Result Set Mapping In Hibernate. We can do this using the SqlResultSetmapping which specifies the mapping for each attribute. If a given JPA GROUP BY query returns only two columns where one is unique its very suitable to return the result as a Java Map.
A Map is mapped with a element in the. Hibernate version is 5012RELEASE. However in order to map using a constructor we need to create one.
A Map is a java collection that stores elements in key-value pairs and does not allow duplicate elements in the list.
Both JPA and Hibernate provide a lot of flexibility when it comes to transforming the result set of a given JPQ query be it JPQL Criteria API or native SQL query. You can vote up the ones you like or vote down the ones you dont like and go to the original project or source file by following the links above each example. Besides being easier to use this also provides the advantage that all information is in the same place. You are already familiar with most of the mapping detail but let us see all the elements of mapping file once again The mapping document is an XML document having as the root element which contains two elements corresponding to each class.