Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Where does the ejbCreate definition come from

 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As you all know, every bean class must declare at least one ejbCreate() method (unless it's a stateful session bean whose home interface has no create() method).

You must declare this according to some rules. As an example, this is what you must do for message-driven beans.

The method name must be ejbCreate.

The method must be declared as public.

The method must not be declared as final or static.

The return type must be void.

The method must have no arguments.

The throws clause must not define any application exceptions.

It's almost as if the bean class is implementing a hidden interface which has this method declared:

public void ejbCreate() throws EJBException

Is there some good reason ejbCreate() is not declared in javax.ejb.MessageDrivenBean?
 
Girija Siva
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Roger
I did not get what ur saying but ...


As you all know, every bean class must declare at least one ejbCreate() method (unless it's a stateful session bean whose home interface has no create() method).

create is mandetory for SessionBean , optional for EntityBean and no create as there is no home interface for MessageBean Is it not.? Am i missing something fundamental here in understanding what ur trying to say???

 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A misstype, I meant ejbCreate() is optional for Entity beans. It's after midnight, I've been at my PC all day .

Anyway, the question remains: where is ejbCreate() defined?
 
Girija Siva
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the bean class
 
Girija Siva
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ejbCreate is in bean class and for other beans it has got matching create() in the home interface for the client to initiate the creation. But in case of MDB there is no matching as there is no client and no HOME. Observe even in case of Staless SessionBean even if there is matching create it has nothing to with the ejbCreate() in the bean class.

This is a very nice point you raised Roger. I did not looked at ejbCreate() and create() this way before.
This is what My understanding is ..IF anyone has more to add......
 
Girija Siva
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


It's almost as if the bean class is implementing a hidden interface which has this method declared:




Is there some good reason ejbCreate() is not declared in javax.ejb.MessageDrivenBean?



The way I look at it is the developers only way to participate in beans creation. Obtain resources that are required or do things like that if business needs it. Without this method there is no way for the developer to say a word in beans creation
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic