• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

My mock exam questions.

 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My question about the mock exam is ,

1. 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

2.

sending a JMS message from within the setMessageDrivenContext
method



is that action valid? the EJBPlus said that is right, however I can not find related description in EJB Spec

3.

Which three method of stateful session bean are called with an
unspecified transaction context?
A. constructor
B. afterBegin
C. afterCompletion
D. beforeCompletion



I think only the constructor and afterCompletion is correct answer, but is ask for 3 correct answer
[ September 24, 2005: Message edited by: Zee Ho ]
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my opinion;

1) Option 'B' seems right, "Foo create();" can be the part of local home
interface instead.

2) We can't Access JMS Resource Manager Connection factories from
setMessageDrivenContext, the only place we can access JMS RMCF is
onMessage(), hence statement seems invalid.


3) I don't see third correct answer. Options A and C should be the only
correct choices.

Corrections to above replies would be appreciated.

Regards
 
Zee Ho
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thx for ur reply, but for the 1st question, why A is incorrect? is it because of the return type or whatever? I think for the method name itself is not invalid, also, I do think write a method named create is really confused, but is it not allowed?(as the create can be one of the business method with bad name)
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't lose any sleep over these junk questions.

Whoever came up with (1) probably wanted to see if you could tell the difference between a Home interface and a Component interface - I can't cite a reason why (A) is wrong - though its suspect, you better have a good reason for returning another instance (or the same?) of the component interface of a stateless object that theoretically has exactly the same capabilities as the current one (because it lacks state). I can't think of one. I think someone simply clobbered a Home interface to see if you could tell the difference between a component interface and a home interface.

(2) Pretty much the only thing you can do in setMessageDrivenContext other than storing the context reference, is using JNDI. Any accesses to any resource managers or invocation of other beans has to wait until onMessage().

(3) In this one you would have been well within you rights to say that only (A) is valid. The other three aren't even available unless your stateful session bean implements the SessionSynchronization interface which you can only use with CMT - which the question does not explicitly mention (and it certainly does not occur by default). And as you indicated, even if you do implement SessionSynchronization, afterBegin and beforeCompletion occur within the transaction - calls to getRollbackOnly() and setRollbackOnly() are valid during those methods.
 
Zee Ho
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thx for reply. now got it.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic