O'Reilly logo

EJB 3 in Action, Second Edition by Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 10. Managing entities

This chapter covers

  • EntityManager
  • Entity lifecycle
  • Persisting and retrieving entities
  • Entity scopes

Chapter 9 introduced the basics of JPA entities. You saw how to implement the domain objects with JPA, define relationships between objects, and handle inheritance. In this chapter we’re going to delve into EntityManager and show how to manage entities. We’ll discuss what an EntityManager is and how to inject them into your EJB classes. You’ll learn about the lifecycle of entities and how to use EntityManager to persist, find, merge, and remove entities—the EntityManager equivalent of the basic database CRUD (create, read, update, delete) operations. You’ll also learn about the different scopes entities go ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required