sanjeev mehra

Ranch Hand
+ Follow
since Feb 12, 2001
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sanjeev mehra

Praveen C Kidambi wrote:Hi,
I have a SCBCD 5.0 (CX-310-091) voucher for sale with a free retake exam. I bought it in the US and it is valid till May 19, 2009. The current price is $300. I can sell it for $175. Let me know.

SCJP 5.0, SCWCD 1.4

I am interested to buy immediately, you can reach me at or 732-512-7184.
or please drop your contact no.

15 years ago
Mark Garland your answer is helpful to me.

Session bean - to write say hello method

in EJB 2.x ,you need to write
home interface
component interface

in EJB 3.x ,you need to write
interface (with annotation)
bean (with annotation)

EJB 2.x; lookup is the only way to get server object/resource
EJB 3; DI (dependency injection) & lookup are the available way

there are more points. but basically, with EJB 3 responsibility of container is heavy & responsibility of developer is light weight; so that development is less & maintainance is easy.
container - a box like JVM provides basic services

Web application is deployed in Web server which has web container
Web application - JSP, Servlet, Java,...

Enterprise App is deployed in Application server which has Web container, EJB container, set up for messaging services etc.
EE app. - JSP, Servlet, Java, EJB, Web Services, JMS......

You have posted few more questions; I would suggest google those topics & spend sometime on few articles. You are the King....
thanks for reply.
for compiler @Stateless annotation does not make sense;
its container which treats it like EJB.
In other case, basic rule is a class can not 2 classes;
and if a class extends 2 classes, compiler throws error message.

Are both rules (EJB - SB bean must not extend another SB & a POJO class must not extends 2 POJO classes) comes in to different categories? So that first is okay for compiler but not the second.
PostConstruct & ejbPostCreate are same for Session bean in EJB 2.x & EJB 3.
[ July 09, 2008: Message edited by: sanjeev mehra ]
Jothi Shankar Kumar

From the ok but I read in the book EJB 3 in Action on Subclassing rules for Session beans?? Here is what it says...

quote:A session bean class can subclass another session bean or any other POJO.
For example, a stateless session bean named BidManager can extend
another session bean PlaceBidBean in the following way:
public BidManagerBean extends PlaceBidBean implements BidManager {

Same book (EJB 3 In Action) also says that if parent is a bean then bean annotation is not inherited; but call back (life cycle) annotation, business methods,.... are inherited from parent class.

nitin pai

A session bean class must not have a superclass that is itself a session bean class.

As per spec, parent must not be a bean (session bean), isn't it compile time issue (compiler is allowing to have bean parent)?
I meant using DI client would have 2 object

Using lookup client would have only 1 object, since lookup can be kept under condition.

what I am trying to understand is that lookup process has advantage in this case compare to DI.

Am I correct?
I agrees to deploy 2 beans,
And client side needs 2 DI (which means injection of two EJB objects at client side)

But if I use lookup (initCtx.lookup) based on condition; then only one EJB would be injected (client would be bound / have only one EJB) and can avoid second EJB, which is not needed.

Am I correct?

Business Layer

Client Layer

Since I am using interface in client layer; how would I archive the following;

I would appreciate your help.

No offense, but no body can answer this question; it depends on speed, no of hours study per day, understanding level & past experience.
Please visit Sun web site, get the Exam Objectives, look into book (RMH), and judge it yourself.
Best answer; read KS EJB 2x;

that would help to let you know containers role & importance; & EJB life cycle.

but for now, container (a box) in which EJB resides, provides transaction mgmt, security, bean pooling, ..... etc.
In other case, if you keep your business logic in (POJO) Java class, you would need to take care of all services which are provides by container.
hope this would help.
it may help;

I am not able to understand how is this possible? Does the container take care internally all such issues? But how?

In EJB 2; as you said, lookup+narrow+home then component;
EJB 3; container does all & client gets component;
HOW? then you would need to read specs for container.

If client is in EE environment & uses DI (dependency injection); client does not do lookup; container provides (injects) needed resource.
[ July 02, 2008: Message edited by: sanjeev mehra ]

is it necessary for reading after chapter 12?

You meant, do you need to prepare; ch.13 to ch.15 in EJB 3 in action?
If you do not get clear answer for this; you can see EJB Exam Objective here;
And to get URL I visited sun site and guess what, exam fees is increased & voucher costs $300 now I have plan to get/upgrade few certs. Anyways no other option.....
[ July 01, 2008: Message edited by: sanjeev mehra ]