Doubt regarding JPA namedquery

后端 未结 2 1454
暗喜
暗喜 2020-12-22 05:49

I am trying to execute a namedquery

@NamedQuery(name=\"getEmployeeDetails\",query=\"select e.username,e.email,e.image,e.firstname,e.lastname from Employee e         


        
2条回答
  •  [愿得一人]
    2020-12-22 06:29

    Inspect the returned type by calling .getClass() on a returned object. I'd guess it's an array.

    But this is not really a good way to use JPA. Select the whole entity and then just don't use what you don't need. It's not such a performance hit.

提交回复
热议问题