Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Entnibean removal using remove(Handle) method

 
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?
 
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
 
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.
 
I'd appreciate it if you pronounced my name correctly. Pinhead, with a silent "H". Petite ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic