• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Mock Question HFEJB page 368. Q5.

 
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic