开发者

i added jpa2 jar file to library, but still can't find getCriteriaBuilder method

i am using hibernate jpa, i can use jpql query successfully but i can't use criteria api. i have read JPA Criteria API missing and jar file for JPA 2.0, i added hibernate-jpa-2.0-api-1.0.1.Final file to library and still can't find getCriteriaBuilder() method. Please help me

import javax.persistence.criteria.CriteriaBuilder;
import javax.per开发者_运维技巧sistence.EntityManager;
import javax.persistence.EntityManagerFactory;

method(){
    EntityManagerFactory emf = Persistence.createEntityManagerFactory("Persistenceunit");
    EntityManager em = emf.createEntityManager();
    CriteriaBuilder cb = em.getCriteriaBuilder();
}

i'm using these libraries: My hibernate library files: antlr-2.7.6.jar, asm.jar, asm-attrs.jar, cglib-2.1.3.jar, commons-collections-2.1.1.jar, dom4j-1.6.1.jar, ehcache-1.2.3.jar, ejb3-persistence.jar, hibernate3.jar, hibernate-annotations.jar, hibernate-commons-annotations.jar, hibernate-entitymanager.jar, hibernate-jpa-2.0-api-1.0.1.Final.jar, hibernate-tools.jar, javassist.jar, jdbc2_0-stdext.jar, jta.jar, jtidy-r8-20060801.jar. Which could cause this ?

Also other libraries: jsf-api.jar, jsf-impl.jar, JSTL 1.1 - standard.jar, JSTL 1.1 - jstl.jar, commons-collections-3.2.1.jar, commons-digester3-3.0.jar and prettyfaces


Did you removed JPA 1.0 libraries when you added ones for 2.0? If not, then it looks like EntityManager is picked from there. That's why first point where it fails is method that was introduced in JPA 2.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜