• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

stateless bean component interface question

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sandhya,

Can you please send across the pdf to [email protected]?


Thanks
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any rule saying that the method in the component interface should not start with create.


Thanks,
Shrimon
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic