ansatgol
ansatgol

Reputation: 185

how can i return map as jpa query?

I have a problem. how can i return map as query in jpa ?

Map<string, User> userMap = em.createQuery("select new map(u.id, *) 
from user u"

I want to return map as query but I don't know how to.
and I don`t want to return map using to iterate list. like as the below
How to return HashMap from JPA query?
can someone help me ? in advance thank you.

Upvotes: 1

Views: 3048

Answers (1)

Jake Kim
Jake Kim

Reputation: 112

You have to make a map list at least, which means list cannot be mapped to single map.

Upvotes: 1

Related Questions