Retrieve a row from DB as a Map in Hibernate

后端 未结 3 560
野的像风
野的像风 2021-01-13 05:33

Table Players:

ID | name  | email | age | ...
1  | \'bob\' | null  | 23  | ...

This table is where instances of class Pl

3条回答
  •  甜味超标
    2021-01-13 06:15

    You can use HQL and do a query for selecting the result as a new Map

    select new Map(p.id as ID, p.name as name, p.email as email, p.age as age)
    from Player p
    

    It will return you a collection of maps, being each one of the maps a row in the query result.

提交回复
热议问题