• 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 ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Valid ejbCreate method?

 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this leagl declaration for CMP beans ejbCreate method --

public int ejbCreate() throws javax.ejb.CreateException
 
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it is. It is even valid (ie throwing CreateException) for Session Beans but not for MDBs.
[ March 31, 2005: Message edited by: Keerthi P ]
 
Gemini Moses
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!

This is one from cofee cram in HFEJB
page 363. Enitity bean synchonization chapter.
Question 5.
They have marked this as invalid....
 
Keerthi P
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops. I did not notice the return type of this method. It can't be primitive.
 
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also the ejbCreate method parameters are missing.
[ March 31, 2005: Message edited by: Ravindra Janapareddy ]
 
Gemini Moses
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok. I agree primitive return type is not valid.
SO the method is invalid.

But as I understand, create parameteres are NOT MUST a s per spec. ALthough logically it does not make much sense having create method without any parameters in ENtity bean.

SO I dont agree with Ravindra's poitn for saying this method is invalid.

Am I right?

Gemini
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[ejbSpecs]
SessionBean
The method arguments must be legal types for RMI/IIOP if there is a create<METHOD> corresponding to the ejbCreate<METHOD> method on the session bean�s remote home interface.

A stateless session bean must define a single ejbCreate method, with no arguments.EntityBean
public PrimaryKeyClass ejbCreate<METHOD>(...);

If the ejbCreate<METHOD> method corresponds to a create<METHOD> on the entity bean�s remote home interface, the method arguments and return value types must be legal types for RMI-IIOP.

Specs specifically mentions stateless session bean must/can have ejbCreate with no arguments but it doesn't say anything about stateful session bean or entity bean and if specs leave it open for the developer to draw conclusion then it doesn't mean that it is valid to have a ejbCreate with no arguments in it in a stateful or entity bean.

Thanks

-- Ravi
[ March 31, 2005: Message edited by: Ravindra Janapareddy ]
 
Keerthi P
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

SO I dont agree with Ravindra's poitn for saying this method is invalid.

Am I right?



Yep. You may still have no-arg create() and a corresponding ejbCreate() in the bean class. The container wouldn't be bothering.
 
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Keerthi is right. It doesn't make any sense to have a create method without any parameters but the specs don't say anything about this . That means we can have a create method with no arguments . But it will be like telling the container to create somehting and the something is nothing.

Sawan
 
What does a metric clock look like? I bet it is nothing like this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic