Java Reference
In-Depth Information
Figure 14.10
Disabling login capabilities for user Ben
ically designed to manage this
EJB
type and would contain all the information it
needs to find and interact with it.
When a situation arises where you need to access an attribute on the
EJB
, you
can look up its corresponding MBean. In addition, if each
EJB
type creates its
own type of MBean, you will have an accurate count of the number of
EJB
s being
used. You want your MBean to exist only as long as the
EJB
exists. So, the
EJB
will create and register its MBean upon creation. When the
EJB
is removed, it
will also remove its MBean. You can implement this feature by adding the appro-
priate code to the
ejbLoad()
and
ejbDestroy()
methods of the
EJB
.
14.5.1
Constructing the workflow entity bean
This example creates an entity bean like the one described in the previous sec-
tion. Recall that an entity bean is an
EJB
that is persistent and represents specific
data in a database. Imagine an application that provides business processes for
users. A business process in this case is a workflow that a user goes through to
accomplish a task. The following example creates a workflow
EJB
that acts as a
specific user's current state in a workflow.