Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic