title: Mapping multiple rows from the same database into a single entity
body: <p>I am looking for the best way to map multiple rows in one table into a single entity. The database table I have is shown below:</p>
  
  <pre><code>principal_id    permission    target
  12312313        PERM1         1000
  12312313        PERM2         1000
  12312313        PERM2         1002
  </code></pre>
  
  <p>Ideally I would like to map the contents of this table into my Principal @Entity as a field as follows:</p>
  
  <pre><code>@Entity
  ...
  public class Principal {
      @Id
      private long principalId;
  
      ...
  
      private Map&lt;String, List&lt;Long&gt;&gt; permissionMap;
  
  }
  </code></pre>
  
  <p>What is the best way to do so?</p>