NetBeans generates JpaController with errors
Posted
by Xorty
on Stack Overflow
See other posts from Stack Overflow
or by Xorty
Published on 2010-06-12T19:22:07Z
Indexed on
2010/06/12
19:32 UTC
Read the original article
Hit count: 766
Hi, I am using NetBeans 6.8 for building Spring MVC application.
Techonologies :
- Spring MVC 2.5
- Derby DB
- Hibernate for ORM
- GlassFish v3 server
I use New JPA Controller Classes from Entity Classes for adding ORM file. It is supposed to generate class for managing queries with my POJO files.
Problem is, that NetBeans generates following code, and won't compile :
public int getBrandCount() {
EntityManager em = getEntityManager();
try {
CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
Root<Brand> rt = cq.from(Brand.class);
cq.select(em.getCriteriaBuilder().count(rt));
Query q = em.createQuery(cq);
return ((Long) q.getSingleResult()).intValue();
} finally {
em.close();
}
}
At the picture, there is NetBeans error :
It looks like method getCriteriaBuilder
of Entity Manager Interface is unimplemented. Or some other reason why I can't use it in code.
I don't know what other info should I provide, so please ask if anything comes to your mind.
Thanks
© Stack Overflow or respective owner