How can I include JPA 2.1 feature in Maven project?
Im using Maven 3, JPA 2.1 and Hibernate 4.3.5.Final. I want to use JPA 2.1 because it offers several features, especially adding conditions to the outer outer join clauses. I have included the following dependencies in my Maven project ...
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.3.2.Final</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.3.6.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>4.3.6.Final</version>
</dependency>
However, when I try to compile the following, I get a compilation error ("cannot find the symbol") in the ".on (" section.
final CriteriaBuilder cb = m_entityManager.getCriteriaBuilder();
CriteriaQuery<Message> query = cb.createQuery(Message.class);
Root<Message> messageRoot = query.from(Message.class);
final Join<Message, Group> groupJoin = messageRoot.join(Message_.group);
final Join<Message, MessageReadDate> msgReadDateJoin = messageRoot.join(Message_.messageReads, JoinType.LEFT);
msgReadDateJoin.on(msgReadDateJoin.get(MessageReadDate_.recipient), recipient);
What libraries do I need to include in my Maven project in order to get JPA 2.1 and hence the "join.on" functionality?
+3
source to share