Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFEJB Page 368, Q # 5

 
Alfred Harre
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which are legal declartions for bean's ejbCreate() method?

B. public String ejbCreateAccount() throws javax.ejb.CreateException
D. public int ejbCreate()throws javax.ejb.CreateException

Why can not option D be the correct answer? Any ideas? thoughts?
 
Mike Melton
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this a question about entity or session beans? Either way, option D does not represent a valid signature. For session beans, ejbCreate() should have void return type. For entity beans, ejbCreate() returns the primary key type, which cannot be a primitive type like int. (Note that getPrimaryKey() returns a java.lang.Object!)

HTH
Mike
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic