wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes whizlabs question.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "whizlabs question.." Watch "whizlabs question.." New topic
Author

whizlabs question..

mallika shah
Ranch Hand

Joined: May 11, 2006
Posts: 164
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

Joined: May 11, 2006
Posts: 164
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
}
}
Uchana Jackson
Ranch Hand

Joined: Dec 07, 2007
Posts: 37
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?


SCJP 1.4<br />SCBCD 5
Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 950
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


Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
mallika shah
Ranch Hand

Joined: May 11, 2006
Posts: 164
thanks Sean and Narendra for your reply.
 
wood burning stoves
 
subject: whizlabs question..
 
Similar Threads
help!! on dynamic select box - 2
session bean business interface.
Casting
Loan Calculator program