title: JPQL New Object Instantiation
body: <p>I have two named queries, and both have the same logic, except that each one uses a different object constructor to select the results into</p>
  
  <p>Named Query 1:</p>
  
  <pre><code>SELECT DISTINCT NEW dk.NewsRoomView(n,p)
  FROM NewsItem n LEFT JOIN n.placements p JOIN n.actors a
  </code></pre>
  
  <p>Named Query 2:</p>
  
  <pre><code>SELECT DISTINCT NEW dk.NewsRoomView(n.id,n.title,SIZE(n.attachments),p.id,p.page)
  FROM NewsItem n LEFT JOIN n.placements p JOIN n.actors a
  </code></pre>
  
  <p>The Structure of the NewsRoomView class</p>
  
  <pre><code>public class NewsRoomView{
  
    public NewsRoomView(NewsItem n, NewsItemPlacement p)
      Logger.getLogger(NewsRoomView.class.getName()).log(Level.INFO,"at Contsructor 1");
    }
  
    public NewsRoomView(Long id, String title, Integer attachments, Long pId, Integer page){
      Logger.getLogger(NewsRoomView.class.getName()).log(Level.INFO,"at Contsructor 2");
    }
  }
  </code></pre>
  
  <p>Now whenever Named Query 1 gets executed it successfully prints the "at constructor 1" statement and thus the query returns results, but when Named Query 2 gets executed it neither prints out the statement "at Constructor 2", nor returns results.</p>
  
  <p>The code blocks above are only snippets of what I really have. In reality the second constructor has a 23 long argument list, that represents some more fields in the NewsItem and NewsItemPlacement entities.</p>
  
  <p>I was wondering what could be wrong that prevents the second constructor from returning results, and whether there are limits on the size of the arguments list for the constructor.</p>
  
  <p>Thanks in advance.</p>