Reputation: 19260
I’m using Maven 3, JPA 2.1, and Hibernate 4.3.5.Final. I want to use JPA 2.1 because it offers several features, most notably adding conditions to left 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 and compile the following, I get a compilation error (“cannot find symbol”) on the “.on(“ clause.
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 to get JPA 2.1 and hence the “join.on” functionality?
Upvotes: 3
Views: 12486