Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and 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 ...
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

stateless bean component interface question

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. which one of the following is a valid stateless bean component interface?
A. public interface Foo extends javax.ejb.EJBLocalObject {
Foo create();
}

B. public interface Foo extends javax.ejb.EJBLocalObject {
void method();
void method(float param);
}

My thought is both of them are valid, but there is only one correct answer
Thanks
 
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is interesting ... I also think both are valid and in fact I tried this over sample Local SLSB with J2EE RI...

Where did you come across this question? Do you know what's the correct answer?
 
Ranch Hand
Posts: 284
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Only B is correct.

A is the declaration of a Home interface, except its is declared as implementing EJBLocalObject. This valid in a java point of view, but it is not valid regarding the <b>EJB Law</b>. And for the exam, you must check that code excerpts respect <b>both laws</b>.
 
Ankit Doshi
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apart from this question, did you come across any statement in the spec or somewhere else which stipulates such a EJB law?

If you define a create method in the home interface, a matching ejbCreate in the bean class, then you define a create method in the component interface and a matching create method in the bean class - what's wrong? I don't see (or did I forget) any rule saying that the name of business methods defined in component interface must not be "create" or "find" or something else...
 
Frederic Esnault
Ranch Hand
Posts: 284
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't see this for business methods, but for home business methods.

But anyway, what is given in option A is clearly a create method, returning the Component interface. This kind of methods must be in the home interface, and not in the component interface.

Bean law definitely exists. For example, the create method is not "java-mandatory", even for a stateful session bean, but it is mandatory in such a bean, according to bean law. And try to deploy a stateful session bean without a create method...

Basically, the bean law is...the EJB spec.
 
Sandhya Lever
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks everyone.Te questions are from a pdf sent to me by a friend.The answers are not given.
 
Ankit Doshi
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sandhya,

Can you please send across the pdf to doshiaj@yahoo.com?


Thanks
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any rule saying that the method in the component interface should not start with create.


Thanks,
Shrimon
 
You firghten me terribly. I would like to go home now. Here, take this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic