• 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Coffe Cream on EB - Mistakes/Doubt #2

 
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Regarding the following question:

Which are legal declarations for a CMP bean's ejbCreate methods

A. public void ejbCreateBigCustomer() throws javax.ejb.CreateException

B. public String ejbCreateAccount() throws javax.ejb.CreateException

C. static String ejbCreate() throws javax.ejb.CreateException

D. public int ejbCreate() throws javax.ejb.CreateException

E. public final String ejbCreate() throws javax.ejb.CreateException

I answered B and D - The book gave as correct only B.

The specs, chapter 9.8 say:

The Enterprise JavaBeans architecture allows a primary key class to be any class that is a legal Value
Type in RMI-IIOP, subject to the restrictions defined in Subsections 10.6.13 and 12.2.12.



The restrictions are related to the implementation of hashCode() and equals(). As far as I know, int is a RMI-IIOP legal value, as it's a primitive datatype, therefore Serializable and all the rest. So the signature for answer D should be correct.
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note the key word in the spec:

The Enterprise JavaBeans architecture allows a primary key class to be any class that is a legal Value Type in RMI-IIOP, subject to the restrictions defined in Subsections 10.6.13 and 12.2.12.


As int is not a class, it is invalid. You'd have to use Integer instead.
 
alzamabar
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Roger Chung-Wee:
Note the key word in the spec:

As int is not a class, it is invalid. You'd have to use Integer instead.



Thanks, now I've got it.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic