Forums Register Login

stateless bean component interface question

+Pie Number of slices to send: Send
. 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
+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
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>.
+Pie Number of slices to send: Send
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...
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
Thanks everyone.Te questions are from a pdf sent to me by a friend.The answers are not given.
+Pie Number of slices to send: Send
Hi Sandhya,

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


Thanks
+Pie Number of slices to send: Send
Is there any rule saying that the method in the component interface should not start with create.


Thanks,
Shrimon
Humans and their filthy friendship brings nothing but trouble. My only solace is this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 780 times.
Similar Threads
Help Please
Session EJB 3.1 inheritance
Local Interface & Remote Interface
My mock exam questions.
Mock question about business interfaces
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 18, 2024 20:04:21.