Generally we write the query as
@Query("SELECT a FROM Foo a WHERE a.someId = :id")
Map<Long, Foo> findAllBySomeId(Long id)
Is there a way to get it HashMap instead of List.
I want the key of the Hashmap's key=someId and Value as Foo.
I tried like this
@Query("SELECT new map (a.someId, a) FROM Foo a WHERE a.someId = :id")
Map<Long, Foo> findAllBySomeIdAsMap(Long id);
but it returned two items but a.someId as Value and key as 0;
0=someId
1=Foo