concept scope in category ejb

This is an excerpt from Manning's book EJB 3 in Action, Second Edition.
To use EJB services, your component must be declared to be a recognized EJB component type. EJB recognizes two specific types of components: session beans and message-driven beans. Session beans are further subdivided into stateless session beans, stateful session beans, and singletons. Each component type has a specialized purpose, scope, state, lifecycle, and usage pattern in the business logic tier. We’ll discuss these component types throughout the rest of the book, particularly in part 2. For data CRUD (create, read, update, delete) operations in the persistence tier, we’ll talk about JPA entities and their relationship with EJBs in detail in part 3. As of EJB 3.1, all EJBs are managed beans. Managed beans are basically any generic Java object in a Java EE environment. Contexts and Dependency Injection (CDI) allows you to use dependency injection with all managed beans, including EJBs. We’ll explore CDI and managed beans further in part 3.
The element type specifies the EntityManager scope. As noted, for a container-managed EntityManager, scope can be either transaction or extended. If the type attribute isn’t specified, the scope defaults to TRANSACTION. So, not surprisingly, the typical usage of the type element is to specify EXTENDED for an EntityManager. The code would like the following:
The term scope is used for persistence contexts in the same manner that it’s used for Java variable scoping. It describes how long a particular persistence context remains active. Transaction-scoped persistence contexts can be compared to method local variables, in the sense that they’re in effect only within the boundaries of a transaction. On the other hand, persistence contexts with extended scope are more like instance variables that are active for the lifetime of an object—they hang around as long as the EntityManager is around.