Win a copy of Svelte and Sapper in Action this week in the JavaScript 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Overload ejbCreate on MDB

Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question From Jdiscuss

Which of the following are true regarding the implementation of an Message Driven Bean? Select 3 correct options

A The class must have, directly or indirectly, a non abstract onMessage method.
B It cannot implement ejbRemove method.
C It may implement finalize() method.
D It must implement setMessageDrivenContext() method.
E It may implement overloaded ejbCreate() methods.

Answer of ADE
From Jpilot

Which of the following are requirements for a message-driven bean. Select all 4 correct Choices.

A.It implements the MessageListener and MessageDrivenBean interfaces.
B.It implements one or more ejbCreate methods.
C.It implements one onMessageReceived method.
D.It must not define the finalize method.
E.It implements one ejbRemove method.
F.It must not have a remote or local interface.


From 2 Question. I very suspect about overload of ejbCreate method on MBD Which it can be or can't?

Would someone please advice explain this issue on truely detail.

Thank you so much
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to me It cannot have an overloaded create Method.
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember that MDBs are created by the container. And the container is only interested in simply creating them. There's no additional information the container "needs" to pass to the MDB. If you want to do something special, put it into the setMessageDrivenContext function.
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A message driven bean may have overloaded ejbCreate methods. But, you do not want to do this, it serves no use since the container will never invoke them. The spec does not say anything about this if you ask me, only that it must have atleast one ejbCreate with no arguments.

So, it will be question depended:

The first question says that there are 3 correct answers. It is clear that B and C are totally wrong no matter the circumstance. Option E is correct (it MAY do that) but it has no use. But you need 3 correct answers, so you select it.

For the second question you need 4 correct answers. C is completely wrong. D, E and F are 100% true. And so is A.
You could be doubting that answer B is true also, but if you read the question you will notice that they say it like 'It is a normal thing that an MDB implements more then one ejbCreate' . Which is not, it may do that, but you don't want to do it. So you should feel that answer B is fishy, its not really true but also not really false, while A D E and F are 100% true and C is 100% false. So your answers should be A D E and F.
Warning! Way too comfortable! Do not sit! Try reading this tiny ad instead:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic