• 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

whizlabs question..

 
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Assuming that the stateless session bean does not have a dd, which of the following stateless sb implementation will not be deployed successfully in the EJB 3.0 container?
a.
@Stateless
public class PaymentSessionBean implements PaymentBean{
public void process(Payment pay)
{
//buss logic
}
}

b.
public class PaymentSessionBean extends javax.eb.SessionBean implements PaymentBean{
public void process(Payment pay)
{
//buss logic
}
}

c.
@Stateless
public class PaymentSessionBean extends javax.ejb.SessionBean implements PaymentBean{
public void process(Payment pay)
{
//buss logic
}
}
d.
@Stateless
public class PaymentSessionBean implements PaymentBean{
public void process(Payment pay)
{
//buss logic
}
}

Ans d,a

HOW??
Please help explaining the reason behind the answers.

thanks,
mallika
 
mallika shah
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
correction to the above option d:
there was an ejbCreate() method in it.

d.
@Stateless
public class PaymentSessionBean implements PaymentBean{
public void process(Payment pay)
{
//buss logic
}
public void ejbCreate()
{//impl
}
}
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just created all four of these SLSB's in eclipse.

b and c are having compiler errors due to the session bean class extending (instead of implementing) the javax.ebj.SessionBean interface.

also, this is from 4.3.10.2 of ejb core spec doc:

"If the stateless session bean instance has an ejbCreate method, the container treats the ejbCreate
method as the instance�s PostConstruct method, and, in this case, the PostConstruct annotation
(or deployment descriptor metadata) can only be applied to the bean�s ejbCreate method."

so I understand what the problem is with d or a... a and d should both deploy fine.

have you tried deploying a and d as an EAR in a JavaEE app server?
 
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

The answer should be b and c.

Assuming that the stateless session bean does not have a dd, which of the following stateless sb implementation will not be deployed successfully in the EJB 3.0 container?



Thanks
 
mallika shah
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks Sean and Narendra for your reply.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic