• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Entnibean removal using remove(Handle) method

 
Poobhathy Kannan
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HFE says, you can use remove(Handle) method to remove the entity bean as well.My doubt is ..How can it be removed witout the key?

please explain?
 
Gemini Moses
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not? If you have handle you have have identifier to the bean you want to delete.

Hope it helps!
Gemini
 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two possible scenarios that I could think of.

#1: the client invoked the remove(Handle h) method of an entity bean
#2: an EJB invoked the remove(Handle h) method of an entity bean

For #1:
The client would have a reference to the component interface. And from the component interface, it could invoke the getHandle method to obtain the handle of the entity bean. Then it could call the remove(Handle h) method on the home interface to remove the entity bean.

For #2:
Its rather similar to #1 just that our client becomes another EJB. This EJB could obtain a EJBObject through the same way as a client would. And the same procedure in getting the handle & then removing the bean.

So all in all, you need to know your EJBObject & EJBHome interfaces well enough. We can safely ignore local interfaces for obvious reasons.

Hope this helps.
 
Poobhathy Kannan
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys

we can have EJBOject from getEJBObject() from Handle then can get the prmary key from getPrimaryKey() on EJBobject ...delete

Got cleared.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic