title: Is is possible to use constructor expression for nested class in JPA?
body: <p>Following code</p>
  
  <pre class="lang-java prettyprint-override"><code>package p
  
  @Entity
  @NamedQueries({
      @NamedQuery(name = "A.findAllB"
                  query = "SELECT new p.A.B(a.bId, a.bName) FROM A a")
  })
  public class A implements Serializable {
  
      public static class B {
  
           public B(long id, String name) {}
      }
  }
  </code></pre>
  
  <p>throw exception during application initialization:</p>
  
  <pre><code>Caused by: org.hibernate.HibernateException: Errors in named queries: A.findAllB
  at org.hibernate.internal.SessionFactoryImpl.&lt;init&gt;(SessionFactoryImpl.java:545) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
  at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1859) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
  at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:852) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
  at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:845) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
  at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
  at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:844) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
  at org.jboss.as.jpa.hibernate4.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44) [jipijapa-hibernate4-3-1.0.1.Final.jar:]
  at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:154) [wildfly-jpa-8.2.0.Final.jar:8.2.0.Final]
  ... 8 more
  </code></pre>
  
  <p>However if the <code>B</code> class is moved up to be standalone class <code>p.B</code>, it works ok.</p>
  
  <p><strong>Is it possible to use nested classes with JPA constructor expressions?</strong></p>
  
  <p>Environment:
  Java 8,  Java EE 7, WildFly 8.2, hibernate-jpa-api 1.0.0</p>