File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mock exam question

 
bhargavi kakarala
Ranch Hand
Posts: 82
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
which interface and methods could u use to remove an EJB object?
a)EJBHome.remove()
b)EJBHome.remove(Handle handle)
c)EJBHome.remove(Object object)
d)EJBHome.remove(String PrimarKey)
e)EJBObject.remove()
f)EJBObject.remove(Handle handle)
g)EJBObject.remove(Object object)
h)EJBObject.remove(String PrimarKey)
what r the answers for this question.my answers r b,d,e
 
Chris Lewold
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
b,c,e
The PK doesnt have to be a String
Regards,
Chris Lewold
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
b, c, d and e
 
Philippe Maquet
Bartender
Posts: 1872
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi bhargavi,
I'd reply b, c, e. But the question is a bit confusing : d would be correct if you declared an overloaded remove() method in your home interface. But it wouldn't be EJBHome anymore but MyHome...
Best,
Phil.
 
Dilli raj
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
b,c,d and e are correct answers.
Dilli
[ February 01, 2004: Message edited by: Dilli raj ]
 
Kathy Sierra
Cowgirl and Author
Rancher
Posts: 1589
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy -- yes, I agree with Philippe and Chris -- there is *no* remove() that takes a String in EJBHome. It's kind of a good tricky question though, because we see (and use) so many examples where String is the primary key type, that it's easy to believe that there's a remove that takes a String. And the question is also making sure that you understand two important points about remove:
1). that remove() in the component interface does *not* take any arguments, because you're always telling the container to remove the object on which you invoked remove().
2). that remove() in the home interface MUST take arguments, since there would be no way for the container to know WHICH bean from that home you're trying to remove.
So... bottom line:
1) remove in the component interface NEVER takes arguments
2) remove in the home takes arguments... but it depends:
A) in the Remote home, there is a remove() that takes an Object (for the primary key) AND a remove() that takes a Handle)
B) in the local home, there is *only* a remove() that takes an Object, because Handles do not apply with local interfaces (which of course *also* means that you cannot use a local Home to remove a Session bean! Since session beans don't have keys...)
Cheers,
Kathy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic