• 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Why does the ejbCreate() returns null

 
Ranch Hand
Posts: 321
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kathy,
Why does the ejbCreate(0 returns null in case of EJB2.0 Entity Bean which was not the case in EJB1.1.
Rgds
Rishi
SCJP,SCWCD, IBM/OOAD
 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy,
I'm pretty sure that this hasn't changed with EJB 2.0 -- the way it works is that BMP beans you MUST return the primary key, and with CMP, you return null (the Container then uses what you've specified as your primary key field (or, with a compound key, the CMP fields that together make up the primary key).
So, the return type of ejbCreate() is always *declared* as the primary key type, but with CMP you are supposed to return null (although some Containers won't complain if you return anything else, because it's ignored anyway, but we recommend that you ALWAYS follow the spec, to be safe and portable.)
cheers,
Kathy
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


So, the return type of ejbCreate() is always *declared* as the primary key type, but with CMP you are supposed to return null (although some Containers won't complain if you return anything else, because it's ignored anyway, but we recommend that you ALWAYS follow the spec, to be safe and portable.)


It's cleared in return type of ejbCreate.
 
Ranch Hand
Posts: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess it is no longer a requirement for EJB 2.0.
 
I've got no option but to sell you all for scientific experiments. Or a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic