• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Head First EJB question

 
Kanag sen
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have a question that I wanted to clarify. On page 140 HFEJB it is given that if the bean does not exist then then getEJBObject returns an Exception. But on page 143(last para) it is given that the handle has the smarts to get a different EJB object. Can someone explain both of the scenarios
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Enterprise JavaBeans Specification, Version 2.0

Chapter 6 Client View of a Session Bean
6.6 Session object identity
A session object handle can be held beyond the life of a client process by serializing the handle to persistent store. When the handle is later deserialized, the session object it returns will work as long as the session object still exists on the server. (An earlier timeout or server crash may have destroyed the session object.)


Based on my understanding of the EJB architecture these are some scenarios I can envision:

Stateless SessionBean handle.getEJBObject() throws an Exception if:
  • EJB Server is unavailable for connection
  • Bean type has been undeployed


  • Stateful SessionBean handle.getEJBObject() throws an Exception if :
  • EJB Server is unavailable for connection
  • Bean type has been undeployed
  • The beans state information has been irretrievably lost. It no longer exists in the "Method Ready" state nor in the server's passivation store ("Passivated" state). The server either timed the instance out or the server crashed.


  • EntityBean handle.getEJBObject() throws an Exception if :
  • EJB Server is unavailable for connection
  • Bean type has been undeployed
  • The underlying entity has been removed (DELETE) from the underlying persistent store (database) by another client.


  • There may be more - but at least this is a start.
    [ October 03, 2005: Message edited by: Peer Reynders ]
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic