官术网_书友最值得收藏!

Summary

Entities are classes that need to be persisted, usually in a relational database. The persistence aspects of EJB 3 have been packaged as a separate specification, the Java Persistence API (JPA), so that applications that do not need EJB container services can still persist their entities to a relational database. Persistence services are handled by a persistence engine. In this chapter we make use of the Toplink persistence engine that comes bundled with the GlassFish application server.

Any Java class, or POJO, can be converted to an entity using metadata annotations. We described by means of an example the default rules for mapping an entity to a relational database table.

We introduced the EntityManager service, which provides methods for persisting, finding, querying, removing and updating entities. We saw examples of the EntityManager.persist() and EntityManager.find() methods. We introduced the concept of a persistence context, which is the set of managed entity instances.

We looked at Ant scripts for packaging and deploying an application which uses entities.

We examined strategies for generating primary keys. Finally we looked at examples of overriding default rules for mapping entities to relational tables.

主站蜘蛛池模板: 建水县| 宜昌市| 韶关市| 历史| 上蔡县| 永修县| 阿合奇县| 日土县| 余庆县| 丹寨县| 米易县| 上犹县| 横山县| 淳化县| 白银市| 通州市| 开鲁县| 桃园市| 江油市| 新营市| 山阳县| 鄂托克旗| 曲周县| 常德市| 婺源县| 鱼台县| 酒泉市| 南城县| 卢湾区| 通海县| 广河县| 大关县| 昌邑市| 石阡县| 三明市| 长沙市| 鄯善县| 界首市| 会泽县| 高邮市| 江津市|