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

  • EJB 3 Developer Guide
  • Michael Sikora
  • 188字
  • 2021-07-02 11:34:56

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.

主站蜘蛛池模板: 信阳市| 鹤山市| 富阳市| 渝中区| 门源| 江孜县| 云龙县| 韶关市| 上高县| 巴林左旗| 宁陕县| 丰城市| 舒兰市| 博客| 北碚区| 阿巴嘎旗| 小金县| 饶河县| 龙州县| 新河县| 赤壁市| 麦盖提县| 丹江口市| 莎车县| 高邮市| 黎城县| 南宁市| 金塔县| 内丘县| 龙江县| 新宁县| 项城市| 岳阳县| 安仁县| 湖南省| 嘉荫县| 鹰潭市| 亳州市| 长春市| 金坛市| 墨玉县|