从JPA读取数据的方法 [英] Read Data from JPA the ways to do it

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

问题描述

我阅读了文档,并且看到要读取jpa数据,我需要使用以下代码. 这是通过sql从JPA表中读取数据的唯一方法吗?

I read in the documentation and i see that to read the jpa data i need to use the following code. this is the only way to read the data from the JPA tables via sql?

 factory = Persistence.createEntityManagerFactory("abc");
EntityManager entityManager = factory.createEntityManager();
Query query = entityManager.createQuery("SELECT p FROM " + className + " p");

推荐答案

有几种使用JPA读取数据的方法.您提供的示例使用的是 JPQL .此外,您可以:

There are several ways to read data using JPA. The example you provided is using JPQL. Additionally, you can:

  1. 通过

  2. 使用标准API

    使用

  3. 这篇关于从JPA读取数据的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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