• Post Reply Bookmark Topic Watch Topic
  • New Topic

ejb basic question  RSS feed

 
vn us
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a stateless session bean and the following are some of the container contract methods.
If i have the following code
Am I correct If I state the following?
Assuming that the ejb container starts and stops with out any crashes and also no exceptions from the container JVM while JVM is running.
The # of ejbCreate() method calls is equalant to # of calls to ejbRemove

Code is as follows ( Hello is a helper class )
public void ejbCreate()
{

h = new Hello();
System.out.println("Inside HelloBean Create");
}
public void ejbRemove() throws RemoteException
{
h = null;
System.out.println("Inside HelloBean remove");
}
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The # of ejbCreate() method calls is equalant to # of calls to ejbRemove
The number of calls could be different if an instance has thrown a system exception, thus, causing the instance to move from "method ready" (or "method ready in transaction") to "does not exist" without the container ever calling ejbRemove() on that particular instance.
Take a look at chapter 7.6.3 of the EJB 2.0 specification.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!