title: JPA Projection with custom collection property
body: <p>We are using Spring Data and trying to create a custom query with a subquery, results projection have an array and other properties, our problem is with the subquery array.</p>
  
  <pre><code>    public interface ProfesionalRepository extends JpaRepository&lt;Profesional, Long&gt; {
  
      @Query("SELECT p.id as idProfesional, " +
              " p.name as name, " +
              " p.surname as surname, " +
              " (SELECT a.descripcionIlt FROM Ausencia a WHERE a.profesional.id = p.id) as exclusionesCenso " +
              " FROM Profesional p ")
      List&lt;ProfesionalCensoProjection&gt; findCenso();
  }
  </code></pre>
  
  <p>Projection as:</p>
  
  <pre><code>public interface ProfesionalCensoProjection {
      Long getIdProfesional();
      String getName();
      String getSurname();
      List&lt;String&gt; getExclusionesCenso();
  }
  </code></pre>
  
  <p>We get an error like this: </p>
  
  <pre><code>Caused by: java.sql.SQLException: ORA-01427: single-row subquery
  returns more than one row
  </code></pre>
  
  <p>We found other posts like: <a href="https://stackoverflow.com/questions/45170258/can-spring-jpa-projections-have-collections">Can Spring JPA projections have Collections?</a></p>
  
  <p>But we cant find examples with subquery.
  If JPA doesn´t allow, which is the best solution for this problem?</p>
  
  <p>Thanks,</p>