• Post Reply Bookmark Topic Watch Topic
  • New Topic

Session Bean  RSS feed

 
san yee
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one please tell me,can a session bean be defined without a ejbCreate() method.

Thanks in Advance.
 
Pavel Kubal
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, session beans are required to have at least one ejbCreate() method.

Stateless without parameters and stateful can have more overloaded methods.
 
Prabhu Venkatachalam
Ranch Hand
Posts: 502
Java jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ejbCreate() used in bean creation process. when you call create() method from EJBHome, container will call ejbCreate() call back method to inform you that bean is created sucessfully.

So, for each create() method in EJBHome, there should be equivalent ejbCreate() method in Bean class.
 
Joe Khan
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why ejbCreate is not defined in EnterpriseBean interface or its subinterfaces?
[ December 23, 2006: Message edited by: Joe Khan ]
 
Sachin K Deshmukh
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The J2EE specifications says- The home interface of a Stateless Session Bean must have a single create() method with no arguments, while the session bean class must contain exactly one ejbCreate() method, also without arguments. Stateful Session Beans can have arguments (more than one create method) stateful beans can contain multiple ejbCreate().

The ejbCreate() methods is part of the bean�s lifecycle, so the compiler will not return an error because there is no ejbCreate() method.
You need a reference to your EJBObject to startwith.

-Sachin Deshmukh
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!