• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

need of EJB and where and when we use this EJB component?Why we cant do the same work

 
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi to all
I have just started preparation of this SCBCD exam.But one very basic question strikes my mind that is What is the need of EJB and where and when we use this EJB component?Why we cant do the same work by Web components(servlets/jsp)as EJB do ?In what situation and condition and why we use EJB ,inspite of web components.What is the necessity of using this EJB rather than web components.
Please explain me with an example.
[ June 30, 2008: Message edited by: pradeep singh ]
 
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well,
for example, if you need mission critical applications which require a lot of scalability.
Or if you need a real transational application.
Or if you need asynchronous elaborations.
Or if you have to implement reusable business components.

Any other?
 
pradeep singh
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Sorry ,unable to understand.Please clear me in detail.
 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For example, EJB Container gives you the opportunity to manage your business logic in a transaction-aware environment. The transaction context where your business logic lives extends the transaction concept beyond the simple database transaction (for example, if you create a timer, a roll back invalidates that creation).
Moreover, you might need to execute asynchronous elaborations. This might be done sending messages and writing your business logic into your Message Driven Bean.
Consider, also, that the container manages pool of instances in a way that it scales over the number of requests. And if it is not enough, most commercial application servers allow you to clusterize your EJB container.

Finally, consider that EJB are not the solution for any application: for example, if you don't have real mission-critical environments, the web tier should be enough. But it would be a strict bond: one day, if your logic required a more affordable environment, or if you had to asynchronously execute elaborations, you would be in trouble.
 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic