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 HFEJB page 368. Q5.

 
Simon Ingram
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello fellow ranchers,

Legal declarations for ejbCreate methods. We are that the following is correct

public String ejbCreateAccount() throws javax.ejb.CreateException

but

public int ejbCreate() throws javax.ejb.CreateException

is wrong. I thought both were correct. We can use a primative as a key, can't we?

regards
Simon
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Although the spec is not clear on this, it appears as if a Serializable class is needed. So, this would be valid:

public Integer ejbCreate() throws javax.ejb.CreateException

And your DD entry would read:

<prim-key-class>Integer</prim-key-class>

If the bean provider implicitly declares in the entity bean class the type of the PK to be int, then one presumes that the container makes the necessary conversion between primitive type and wrapper type.
 
Simon Ingram
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Roger,

Yes, I guessed it may be something like that. Strange that the spec only says that it must be a legal value type in RMI-IIOP which includes primatives!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic