• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Return type of ejbCreate

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all
According to the section 10.6.4 of the EJB 2.0 Specs, the return type of ejbCreate method of a CMP enity bean is the primary key type of the bean. The primary key field cannot be a primitive type, so that means that ejbCreate cannnot return a primitive type.
However, I have seen examples in which ejbCreate returns the int return type. Also void in some cases.
Can someone please comment on this ?
Thanks
Vipin
 
Saloon Keeper
Posts: 3929
43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I can hardly believe that ejbCreate can return primitive, because it must return anything which is child of java.lang.Object.
NOTE, CMP beans should actually return "null" in ejbCreate, and BMP "real" PK.
about "void" return type for ejbCreate - this is signature for session beans, not entity beans.
 
Vipin Mohan
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
Thanks for your reply. I wanted to be sure, because I have seen some wrong examples with int as return type of ejbCreate.
Just saw your SCBCD study guide. Really good work you have got here.
Congrats !
Vipin
 
Mikalai Zaikin
Saloon Keeper
Posts: 3929
43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, Vipin
It's not finished yet. Work in progress.
Hopefully in 1..2 weeks it will be done.
 
stable boy
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The return type cannnot be void, final or static for CMP Entity beans.
And the return type must be the primary key class (String, Object, compound)
However the actual return value is null.
 
Without subsidies, chem-ag food costs four times more than organic. Or this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic