File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes remove methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "remove methods" Watch "remove methods" New topic
Author

remove methods

vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580
In EJBHome
void remove(handle h)
void remove(Object key)

In EJBObject
void remove()

Is All these methods focus on removing beans right??

Whats difference between them (other then what we are passing as arguments)
cheenu Dev
Ranch Hand

Joined: Nov 13, 2005
Posts: 276
in EJBHome,

remove(handle) --- for remote interface alone, also only for beans supplied by this home alone.
remove(key) ---- for entity beans alone.

void remove() --- to remove the ejbobject reference you hold.
for stateful session bean it removes even the bean instance.


cheenujunk@gmail.com
Charlie A
Greenhorn

Joined: Apr 17, 2005
Posts: 19
Yes all these methods focus on removing the beans. You can remove the bean either via home or component interface.


As you might be aware that there will be only one home for several bean instances of same type. Each bean has its own component interface tied to it. Suppose if you want to remove a bean using home interface methods how will you make the container identify the particular bean ? Since many bean instances are tied to the same Home Object. So we pass argument to identify the bean.

For session beans we pass the Handle as arguement and Object for Entity beans. Invoking the method remove(Object key) will delete the particular entity (row) fron the database.


In EJBHome
void remove(handle h)
void remove(Object key)


remove() method in EJBObject can be used by both Entity and Session beans

In EJBObject
void remove()


When the world says, "Give up,"<br />Hope whispers, "Try it one more time."
vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580
Thanks charlie and cheenu
vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580
Sorry one more doubt in this flavour,

Suppose if we are calling remove(either from home interface or from component interface) on stateless session bean, what is the effect on it.
Charlie A
Greenhorn

Joined: Apr 17, 2005
Posts: 19
Simple.. Just a fundamental rule you need to remember

"Stateless session beans can neither be created nor can be removed, by the clients, but it moves in and out of the pool"

Stateless session beans totally lives on the mercy of the container. So when the client calls the remove() method, the container will just put back the bean into the pool. If the container feels that its lacking resources, it just kills few of the beans in the pool.
 
jQuery in Action, 2nd edition
 
subject: remove methods