title: NetBeans generates JpaController with errors
body: <p>I am using NetBeans 6.8 for building Spring MVC application. </p>
  
  <p>Technologies :</p>
  
  <ul>
  <li>Spring MVC 2.5</li>
  <li>Derby DB</li>
  <li>Hibernate for ORM</li>
  <li>GlassFish v3 server</li>
  </ul>
  
  <p>I use <strong>New JPA Controller Classes from Entity Classes</strong> for adding ORM file. It is supposed to generate class for managing queries with my POJO files.</p>
  
  <p>Problem is, that NetBeans generates following code, and won't compile :</p>
  
  <pre><code>public int getBrandCount() {
          EntityManager em = getEntityManager();
          try {
              CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
              Root&lt;Brand&gt; rt = cq.from(Brand.class);
              cq.select(em.getCriteriaBuilder().count(rt));
              Query q = em.createQuery(cq);
              return ((Long) q.getSingleResult()).intValue();
          } finally {
              em.close();
          }
      }
  </code></pre>
  
  <p>At the picture, there is NetBeans error :
  <a href="https://i.stack.imgur.com/Lun2L.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Lun2L.jpg" alt="alt text"></a>
  </p>
  
  <p>It looks like method <code>getCriteriaBuilder</code> of <a href="https://docs.oracle.com/javaee/6/api/javax/persistence/EntityManager.html" rel="nofollow noreferrer">Entity Manager Interface</a> is unimplemented. Or some other reason why I can't use it in code.</p>
  
  <p>I don't know what other info should I provide, so please ask if anything comes to your mind.</p>
  
  <p>Thanks</p>