Id like to know if there's a way of doing something like the Stream API groupingBy Collector. I know hot to select one column (the question was marked as duplicated and I don't belive it is) I want to do a grouping (like the groupingBy collector of the java Stream API) not a group By. Suppose you have a table (ONE table) like:
+---+---+
+ A | B +
+---+---+
+ 1 | 1 +
+ 1 | 2 +
+ 1 | 3 +
+ 2 | 1 +
+---+---+
And I would like to have something like
@Entity
public class MyEntity {
  private int a;
  private List<Integer> b;
}
with a repo like
public interface MyCrudRepo extends CrudRepository<MyEntity,Integer>{
  List<MyEntity> findByA();
} 
or
public interface MyCrudRepo extends CrudRepository<MyEntity,Integer>{
  @Query("SSELECT m.a,m.b FROM MyEntity m")
  List<MyEntity> customFind();
} 
This is not necessarily how it should look at the end, anything that works similar to this is fine. I have looked into projections but all examples use 2 different tables.