Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

overloading ejbCreate() methods

 
Walker Rustin
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can the ejbCreate() methods could be overloaded in EJB? I'm getting conflicing answers?
thanks.
- Walk Rustin
 
Anthony Watson
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A stateless session bean and a message driven bean can have one and only one ejbCreate method that takes no arguments. Stateful session beans and entity beans can have multiple ejbCreate methods.
 
MaxPwr Pow
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
stateful beans can have 0(zero) to many create methods and it's optional for it to have a create() method(the one that takes no arguments). entity bean is not required to have create() since create for entity beans means 'a request to insert an entity into the db"
 
MaxPwr Pow
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>stateful beans can have 0(zero) to many create methods and it's optional for >it to have a create() method(the one that takes no arguments). entity bean is >not required to have create() since create for entity beans means 'a request >to insert an entity into the db"
correction: entity beans can have 0 to many create methods. Stateful beans must have 1 to many create methods and it's optional to have a create() method.
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hope I am not going to confuse with this summary
SLSB and MDBs - 1 ejbCreate() method - strictly no parameters.
SFSB - 1 or more ejbCreate() methods, can be overloaded.
Entity Bean - 0 or more ejbCreate() methods, can be overloaded.
[ March 18, 2004: Message edited by: Vish Kumar ]
 
Walker Rustin
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
guys thanks for answering but I'm not getting the answer to my question.
Stateful session bean and entity bean can have mulitiple create(). Now if I want to have two create methods for each type of bean, can I have them overloaded ?
thanks.
- walk rustin
 
MaxPwr Pow
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes
 
Walker Rustin
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
INESystem question:42 mock question series:4 say the creat methods can NOT be overloaded. I told you I am getting inconsistent answers.
I don't work on ejb or I could have tested it out myself. But then who knows what the spec says and what the vendor follows. It's all a big mess.
- walk rustin
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Walker Rustin:
guys thanks for answering but I'm not getting the answer to my question.
Stateful session bean and entity bean can have mulitiple create(). Now if I want to have two create methods for each type of bean, can I have them overloaded ?
thanks.
- walk rustin

As Max said, .......YES.
It is possible to have multiple create() methods for SFSB and Entity beans.
You can have them overloaded, try to 2 create methods for each type of bean.
It is not possible to have multiple create() methods for SLSB and MDB.
These type of beans should have only 1 create() method which is with no parameters.
[ March 24, 2004: Message edited by: Vish Kumar ]
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Walker Rustin:
INESystem question:42 mock question series:4 say the creat methods can NOT be overloaded. I told you I am getting inconsistent answers.
I don't work on ejb or I could have tested it out myself. But then who knows what the spec says and what the vendor follows. It's all a big mess.
- walk rustin

Does your mock exam question mention what type of bean is it related to?
The SCBCD exam is related to SUN's EJB2.0 spec, So I would suggest you to trust the spec more than any application server or mock software out there." ....There could be plenty of vendor specific features in the application server that are not related to the exam and mistakes, yes mistakes in the mock exams!
All you need is a computer with JDK1.3. Once you have the environment(J2EE Reference implemenation 1.3) set up to learn/practice EJBs, it hardly takes any time to check this out yourself. You are likely to get deployment errors if you do not stick to the specification.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic