• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

remove methods

 
vidya sagar
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Charlie A
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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()
 
vidya sagar
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks charlie and cheenu
 
vidya sagar
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic