title: Java 8 stream.collect(Collectors.grouppingBy()) returns map of size 0 when used on a JPA obtained list/object
body: <p>I have the following class structure</p>
  
  <pre><code>public enum RPAttributeStatus {
      NOT_CREATED,
      UPDATED
  }
  
  public class RPAttribute{
      private int id;
      private RPAttributeStatus status;
  }
  
  
  public class RP{
      private int id;
      private List&lt;RPAttribute&gt; listOfRPAttributes;
  }
  
  //with getters and setters
  </code></pre>
  
  <p>After i get the RP object I want to obtain a map with the key as the <code>RPAttributeStatus</code> and the value should be a <code>List&lt;RPAttribute&gt;</code></p>
  
  <p>I am getting the object from a JPA Dao:</p>
  
  <pre><code>RiskProfileDao riskProfileDao = new RiskProfileDao();
  RiskProfile riskProfile = riskProfileDao.findById(id);
  </code></pre>
  
  <p>And I'm trying to obtain the map as follows: </p>
  
  <pre><code>riskProfile.getRPAttributes().stream().collect(Collectors.groupingBy(RPAttribute::getStatus));
  </code></pre>
  
  <p>But I always get a map of size 0 but the <code>RP</code> object contains a populated list of <code>RPAttributes</code> that are not null, and have a status.</p>