Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
The Software Craftsman
this week in the
Architect Certification (SCEA/OCMJEA)
Joined: Apr 01, 2002
Jan 19, 2005 15:40:00
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
Spec. I think there is nothing wrong if the bean class provides empty constructor. Can anyone explain?
Joined: Aug 05, 2003
Jan 20, 2005 02:23:00
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: "
define a no-arg constructor" would not qualify
Joined: Jan 07, 2005
Jan 20, 2005 02:47:00
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.
Joined: Jul 09, 2001
Jan 20, 2005 08:27:00
Obviously the constructors don't play any role in CMP Entity Beans; all the creation is done via the ejbCreate method.
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.
I also didn't see any reference to this issue in the SUN FAQ EJB Restrictions page:
William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
Joined: Apr 01, 2002
Jan 20, 2005 08:51:00
I am clear. Thank you all.
I agree. Here's the link:
subject: EJB Question
Can I choose BMP along with CM transaction (EJB newbie) ?
Could I define CMR in different ejb-jar??
mock question : Please clarify
About the empty constructor
Threads in EJB
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015