缺少JPA Criteria API [英] JPA Criteria API missing

查看:115
本文介绍了缺少JPA Criteria API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建使用JPA的应用程序,并且我想使用

I'm building application that uses JPA, and I want to use Criteria API as described http://openjpa.apache.org/builds/latest/docs/manual/jpa_overview_criteria.html. More precisely this part:

EntityManager em = ... ; 
CriteriaBuilder queryBuilder = em.getCriteriaBuilder();
CriteriaQuery qdef = queryBuilder.createCriteriaQuery();

问题是我的EntityManager中没有getCriteriaBuilder()方法,并且在persistance-api-1.0.jar

The problem is that there is no getCriteriaBuilder() method in my EntityManager and also CriteriaBuilder and CriteriaQuery cannot be found in the persistance-api-1.0.jar

我想念什么?由于我使用了错误的罐子?我的来自 http://repo2.maven.org/maven2/javax/persistence/persistence-api/1.0/

What am I missing? As I'm using a wrong jar? Mine is from http://repo2.maven.org/maven2/javax/persistence/persistence-api/1.0/

奖励, Oleksandr

Regrads, Oleksandr

推荐答案

标准位于JPA2中,并且您有一个JPA1的jar.还没有官方" JPA2.jar,但是有一个Apache2许可的Apache2. http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/geronimo/specs/geronimo-jpa_2.0_spec/1.0-PFD2/

Criteria is in JPA2, and you have a jar for JPA1. There is no "official" JPA2.jar yet, but there is an Apache2 licensed one from Apache http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/geronimo/specs/geronimo-jpa_2.0_spec/1.0-PFD2/

这篇关于缺少JPA Criteria API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆