Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

EJB Question  RSS feed

 
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Here is a question from one of the mock exams.

In CMP Entity Beans, which of the following statements is true?

a. The Entity Bean Class should not define any constructors
b. The Entity Bean class must define a no-argument constructor

The answer provided is (a). But is it correct? I don't see this in the EJB Spec. I think there is nothing wrong if the bean class provides empty constructor. Can anyone explain?

Thanks,

Prasad
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the catch lies in the sentence construction of the 2nd choice. Obvioulsy u can define a no-arg constructor, but is not mandatory. Thus ths 2nd choice which says: "must define a no-arg constructor" would not qualify
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi!

a) is write as you do not define a constructor in the implementation of an EJB, because there is the ejbCreate method, you use to create the bean. There is no impact if it is a BMP or CMP bean!

Look at the implementations in your guides, there is never any constructor, a class should normally have.

cheers stevica
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Obviously the constructors don't play any role in CMP Entity Beans; all the creation is done via the ejbCreate method.

Prasad said:

I think there is nothing wrong if the bean class provides empty constructor.



There is nothing wrong with it, but providing this constructor doesn't serve any purpose.

BTW, I do see this constructor in a WebLogic 8.1 example.
\bea\weblogic81\samples\server\examples\src\examples\ejb20\basic\containerManaged\AccountBean.java

I also didn't see any reference to this issue in the SUN FAQ EJB Restrictions page: http://java.sun.com/blueprints/qanda/ejb_tier/restrictions.html#threads

Regards,
Dan
 
Prasad Kuppa
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am clear. Thank you all.

Prasad
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!