• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mock question : Please clarify

 
Prasad Kuppa
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please see the following question :
Which of the following are required for a concrete entity bean class (from the Bean Provider)? [Check all correct answers]
1 Must have the finalize() method.
2 The class must define a public constructor that takes no arguments.
3 The class must be defined as public and must be abstract.
4 The class must implement, directly or indirectly, the javax.ejb.EntityBean interface.

The answers given are 2, 3, 4.
I think 3 is not correct because the question is for "concrete" bean class.
BMP entity beans have concrete implementation for bean classes and they are not abstract.
Please clarify.
Thanks,
Prasad
 
Ken Boyd
Ranch Hand
Posts: 329
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you define abstract getters & setters for virtual field of CMP Entity bean your class will be abstract & public (must). Also remember you can have concrete methods in abstract class.
Above apply to bean provider point of view.
 
Prasad Kuppa
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply.
I understand that. What I don't understand is: In the question, why the bean class is called concrete class? ( rather than abstract class )
Prasad
[ February 18, 2004: Message edited by: Prasad Kuppa ]
 
Ken Boyd
Ranch Hand
Posts: 329
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you are using CMT in that case entity bean will be abstract (as we know NO BMT for entity bean)
[ February 18, 2004: Message edited by: Nehul Nalekar ]
 
Todor Mollov
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry to interrupt but Nehul is right:
as we know NO BMT for entity bean
but is wrong for :
if you are using CMT in that case entity bean will be abstract

Entity beans have Bean Managed Persistance BMP or Container Manged Persistance CMP. But they only have Container Managed Transactions CMT.
So if Entity bean is BMP it is concrete and if is CMP it is abstract.
I'm agree with Prasad that something smells about the question.
 
Ken Boyd
Ranch Hand
Posts: 329
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when you are using container manage your class will be abstract & that relate to persistence. Because container will implement all database access code for you. So your getters & setters will be public & abstract. Just wanted to point out that you can use CMT only with entity bean not BMT. But CMT OR BMT won't decide the answer of above question.
You will find such tricky question in mock exam but not in real exam, where everything will be stated in right sense.

Even I was caught in such situation.. read Kathy's reply..
http://www.coderanch.com/t/158645/java-EJB-SCBCD/certification/HF-EJB-PAGE
 
Prasad Kuppa
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Todor & Nehul .
Nehul, your answer is more confusing than the question! When the question is about entity bean persistences, you are also bringing up the transactions into answer!
anyways, I got it.
Prasad
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic