It's not a secret anymore!
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes mock exam question 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 "mock exam question" Watch "mock exam question" New topic

mock exam question

bhargavi kakarala
Ranch Hand

Joined: Jan 03, 2002
Posts: 82
hi all,
which interface and methods could u use to remove an EJB object?
b)EJBHome.remove(Handle handle)
c)EJBHome.remove(Object object)
d)EJBHome.remove(String PrimarKey)
f)EJBObject.remove(Handle handle)
g)EJBObject.remove(Object object)
h)EJBObject.remove(String PrimarKey)
what r the answers for this answers r b,d,e

SCJP2,SCWD,SCBCD,IBM Certified SOA Associate,IBM Certified Architectural Design of SOA Solutions
Chris Lewold

Joined: Dec 16, 2003
Posts: 25
The PK doesnt have to be a String
Chris Lewold
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
b, c, d and e

Java Developer, Thailand
Philippe Maquet

Joined: Jun 02, 2003
Posts: 1872
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...
Dilli raj

Joined: Jan 31, 2004
Posts: 24
b,c,d and e are correct answers.
[ February 01, 2004: Message edited by: Dilli raj ]

Kathy Sierra
Cowgirl and Author

Joined: Oct 10, 2002
Posts: 1589
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...)
I agree. Here's the link:
subject: mock exam question
It's not a secret anymore!