• Post Reply Bookmark Topic Watch Topic
  • New Topic

mock question answer

 
Prashant Neginahal
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I came across a question which says following is correct answer.

public void ejbCreate(String userid) throws InvalidUseridException
{
if(userid.length() == 0) throw new InvalidUseridException(userid);
}

But should it NOT ejbCreate() always throw CreateException?

Thanks,
Prashant
 
Sam Sun
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The CreateException is optional, unless you declare a throws clause with CreateException. (See spec 96)
 
Jim Janssens
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think its more like this:

CreateException MUST be specified in the throws of a create method in the component (local and remote) interfaces of both session and entity.

CreateException MAY be specified in the throws clause of a session beans create method

CreateException MUST be specified in the throws clause of an entity beans create method

CreateException MAY be specified for a entity beans postCreate method.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!