Escolar Documentos
Profissional Documentos
Cultura Documentos
1
• Implementation of certain basic security services.
• Support for transactions management.
2
• A session bean is an EJB bean where each instance of a session bean
is created through its home interface and is private to the client.
• The life time of a session bean is that of its client.
• This allows it to maintain the clients state. E.g. Shopping cart .
• Represents a transient conversation with a client.
• It is relatively short lived. Only for the duration of single
client/server session.
• If the server or client crashes , the session bean is gone.
• Might use an entity bean to make a call , in that case the session bean
is the client.
• The container may optionally implement a swapping mechanism to move
the instances of the session beans from the memory to secondary
storage.
• This can be done by serialization of the bean.
• The method ejbPassivate()-(passivation means the process of swapping
out the bean) and ejbActivate()-(activation means the process of
restoring the bean) allow the container to tell the bean that it is
about to be swapped out and that it has just swapped in.
• If the bean is currently in a transaction , it will not be
passivated(swapped out).
Stateful session bean :-It is one that keeps track of the state
information between method calls or a conversation.
• Essentially a bean with instance variables.
• Maintains a user session.
3
• Since there is conversation between methods the state has to be
preserved.
4
• The container is responsible for persistence.
• You just have to specify which fields are persistent.
• Advanced features like connection pooling and caching are easily
supported.
• The container will load the data from the database into the bean and
then invoke the ejbLoad() to tell that it has just received data from
the database.
• Likewise the container will invoke the ejbStore() to tell its data is
about to be written to the database.
• For portability and scalability a container managed persistence is
used.
5
13. What are the steps involved in running an EJB ?
• Create the Remote and Home interface for the EJB.
• Create the EJB beans class.
• Compile the above classes.
• Create one of the XML based deployment descriptors(session or
entity descriptors).
• Create the EJB jar file of the above classes.
• Deploy the EJB jar file.(To deploy an EJB the appropriate descriptor
is allocated,initialised and serialized and placed in a jar file along with
the EJB classes).The EJB deployer is responsible for installing the
EJB classes in the EJB server.