I am introducing JPA2.0 in my application working on Oracle9i database and I added the libraries EclipseLink(JPA2.0) and created the entity classes but when I use
javax.persistence.criteria.CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
I get the following error
cannot find symbol symbol : method getCriteriaBuilder() location: interface javax.persistence.EntityManager
my web.xml is version 2.4 and here's my persistence.xml
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="MiraclinPU" transaction-type="JTA">
<jta-data-source>jdbc/Miraclin</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties/>
</persistence-unit>
</persistence>
It looks like the app is using JPA1.0 as I read on the forums...Can anyone help?
Use:
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
</dependency>
And not:
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0.2</version>
</dependency>