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数据库中。
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实例。
Each method gains a reference to an EntityManager, which represents the in-memory cache.
每个方法都获取对EntityManager的一个引用,它提供对内存缓存的支持。
The program will assume I'm doing that manually, rather than using an EntityManager, for example.
这样程序就会假设由我手动管理这个ID,而不是使用EntityManager来管理。
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() 方法。
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定义持久性上下文。
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实体组件变得异常简单。
For the second method, you simply create a new team using the name of the team that is passed in, create a transaction, save the new team, and commit the transaction using the EntityManager.
对于第二个方法,只要用传入的球队名创建新的Team,用EntityManager创建事务、保存新球队并执行事务。
For the second method, you simply create a new team using the name of the team that is passed in, create a transaction, save the new team, and commit the transaction using the EntityManager.
对于第二个方法,只要用传入的球队名创建新的Team,用EntityManager创建事务、保存新球队并执行事务。
应用推荐