Win a copy of Getting started with Java on the Raspberry Pi this week in the Raspberry Pi forum!
  • 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
  • Jeanne Boyarsky
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Liutauras Vilda
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Piet Souris

Intresting Question

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For a CMP Entity Bean, what should ejbCreate method return? (EJB Specification 1.1)
A. null
B. Remote interface
C. Home interface
D. Primary Key
E. Enumeration
Referring to book defination.
ejbCreate () method returns PrimaryKey instance for CMP and BMP.
Although it does states that
" In EJB 1.1 the change has been made and they have changed method definitation of ejbCreate to return object of Primary Key type to facilitate subclassing."
In real world it book states that
" In CMP persistence ejbCreate will return null value of type Primary Key"
I found this question being discussed at amit jagal's home page. He has mentioned B - Remote Interface as correct answer.
I really doubt that, but still I am confused whether it can be A (null) or D (Primary Key)
Please reply ASAP.
Thanks,
Chetan Mehta
 
Chetan Mehta
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For a CMP Entity Bean, what should ejbCreate method return? (EJB Specification 1.1)
A. null
B. Remote interface
C. Home interface
D. Primary Key
E. Enumeration
Referring to book defination.
ejbCreate () method returns PrimaryKey instance for CMP and BMP.
Although it does states that
" In EJB 1.1 specification the change has been made for CMP, and they have changed method definitation of ejbCreate to return object of Primary Key type to facilitate subclassing."
In real world it book states that
" In CMP persistence ejbCreate will return null value of type Primary Key"
I found this question being discussed at amit jagal's home page. He has mentioned B - Remote Interface as correct answer.
I really doubt that, but still I am confused whether it can be A (null) or D (Primary Key)
Please reply ASAP.
Thanks,
Chetan Mehta

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Chetan,
A very good question did some reading.. Ed Roman book (P. 238 and P. 249 and EJB 1.1 spec. (P. 131) for CMP.
The spec says.. The "definition" should have PK class as return type. (which you have mention for subclassing..) but the "implementation" should return null. coz. this is anyway ignored by Container.
Now, the Ed Roman book says..
for BMP you should return PK but for CMP the definition could be "void".
I guess, if we dont want anyone to make a BMP by subclassing our CMP then the return type can be "void". That's my reasoning..
As far as the question is concerned the answer should be "null".
I think Amit got it confused with the create on Home interface which will anyway return Remote interface for both CMP and BMP.
Hope this helps.
Anil
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't refer to the 1st edition of Roman's EJB book. It covers EJB 1.0, which is way out-of-date. The 2nd edition just came out this week and does cover EJB 2.0. If you need info on EJB 1.1, use the Richard Monson-Haefel (O'Reilly) book.
The correct answer should be:
The ejbCreate method should be declared to return a primary key type. For the actual return statement within the method, CMP bean should return null, and BMP bean should return a primary key object.
 
reply
    Bookmark Topic Watch Topic
  • New Topic