• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Why does the ejbCreate() returns null

 
Ranch Hand
Posts: 321
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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: 8943
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess it is no longer a requirement for EJB 2.0.
reply
    Bookmark Topic Watch Topic
  • New Topic