Start the transaction scope within the EntityManager.
在EntityManager中启动事务范围。
The EntityManager contains the necessary methods for accessing data.
EntityManager包含访问数据的必要方法。
Create the grid and perform data access using the EntityManager API.
创建网格并使用EntityManagerAPI执行数据访问。
By default, the EntityManager saves data to the embedded HSQL database.
默认地,EntityManager将数据存于嵌入的HSQL数据库中。
Another important rule to follow is the entitymanager-per-request pattern.
另一个要遵循的重要规则就是entitymanager - per - request模式。
Create data classes and a utility class for getting an EntityManager instance.
创建数据类和一个实用类来获取EntityManager实例。
Line 1 obtains an EntityManager instance by one of the several available means.
第1行通过几种可用方法之一获取一个EntityManager实例。
The EntityManager class is used to retrieve, persist, update, and delete entities.
类 EntityManager用于检索,支持,更新以及删除实体。
You can think of the EntityManager as a facade to the underlying persistence mechanism.
可以认为EntityManager是底层永久性机制的Facade。
Each method gains a reference to an EntityManager, which represents the in-memory cache.
每个方法都获取对EntityManager的一个引用,它提供对内存缓存的支持。
You need this XML code to turn on EntityManager injection in the Spring XML configuration.
您需要以下XML代码将在Spring XML配置中启用EntityManager注入。
In addition, you must be conscientious to close the EntityManager when you are done with it.
此外,您必须在加载完成时关闭entitymanager。
The program will assume I'm doing that manually, rather than using an EntityManager, for example.
这样程序就会假设由我手动管理这个ID,而不是使用EntityManager来管理。
EntityManager is the factory that constructs an executable query instance given a JPQL string (line 3).
EntityManager是构造一个包含给定j PQ l字符串的可执行查询实例的工厂(第3行)。
Using an EntityManager instance enables me to delete entities via the remove method, shown in Listing 14.
使用EntityManager实例使我能够通过remove函数删除一些实体,如清单14所示。
You now have a distributed ObjectGrid and the ability to read and write data using the EntityManager API.
您现已拥有分布式objectgrid,以及使用EntityManager API读取和写入数据的能力。
For your first method that retrieves all of the teams in the league, use the EntityManager to create a query.
作为检索联赛中所有球队的首选方法,使用EntityManager来创建查询。
The EntityManager API also makes it possible to execute queries against the grid to retrieve a number of objects.
使用EntityManagerAPI也可以对网格执行查询以检索大量对象。
As part of this exercise, you will also learn about the EntityManager API for storing and retrieving data, rather than the simple map APIs.
作为本练习的一部分,您还将学习使用EntityManagerAPI存储和检索数据,而不是使用简单的map API。
The principal access path to any object in a grid should be either through the Map API or through an EntityManager find() using the object’s primary key.
到网格中任何对象的主要访问方式应该是通过MapAPI或使用对象主键的EntityManagerfind() 方法。
To add a new row to your table, you simply create an instance of your entity class, set the attributes, and tell the EntityManager to persist the new entity.
为了向您的表格添加一个新行,您只需创建一个实体类的实例,设置其属性,并更新类entitymanager以支持新实体。
In this section, you will create the distributed ObjectGrid and describe how to store and read the Employee objects from the grid with the EntityManager API.
在本部分中,您将创建分布式objectgrid,并介绍如何使用EntityManagerAPI在网格中存储和读取Employee对象。
A data access object (DAO) that USES JPA is packaged with a persistence.xml that defines persistence context for the JPA EntityManager used by the application.
使用JPA的数据访问对象(DAO)与persistence . xml打包在一起,后者为应用程序使用的JPAEntityManager定义持久性上下文。
Imagine being able to test a webservice, Stateful bean and extended EntityManager, or Stateless bean with JTA EntitManager and a test case run in a transaction.
畅想一下,你可以测试webservice、Statefulbean及扩展的EntityManager,或者测试带有JTAEntityManager的Stateless bean并且测试用例运行于一个事务之内。
The @PersistenceContext annotation of the EntityManager object ensures that the Blueprint container injects this object, ready for use, into the bundle at run time.
EntityManager对象的 @PersistenceContext注释确保Blueprint在运行时将这个对象(准备使用)注入到捆绑包。
Here, DBWriter is the interface class. There is no requirement to call the DBWriter setUp method because the EntityManager will be directly injected into the bundle.
在这里,DBWriter是接口类,不需要调用DBWritersetUp方法,因为EntityManager将直接注入到捆绑包中。
However, you failed to note that if you don't use the JPA entity within a transactional context, you need to do an explicit save to the EntityManager to persist any changes.
然而,您没有注意到,如果没有在事务上下文中使用JPA实体,则需要显式保存到EntityManager以保存任何更改。
For a JTA EntityManager, the JTA transaction is propagated to the underlying resource manager (i.e., the virtual database, which relays the transaction to physical databases).
对于JTAEntityManager, JTA事务被传递到底层的资源管理器(即虚拟数据库,由它将这个事务中继到物理数据库)。
Our EntityManager query performance experiment demonstrates that, in this case, you can achieve a result that is almost 2000 times faster just by adding an index configuration.
我们的EntityManager查询性能试验表明,在这种情况下,您只需添加一个索引配置就可以获得比之前快2000倍的结果。
Finally, you rightly pointed out that there is only one EntityManager implementation, which eliminates the need to do a JNDI lookup, and makes using a JPA entity component extremely easy.
最后,您正确地指出EntityManager实现只有一个,这就不需要进行JNDI查找,并使得使用JPA实体组件变得异常简单。
应用推荐