File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Why we use EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Why we use EJB" Watch "Why we use EJB" New topic

Why we use EJB

Kavisha Paranamana

Joined: Jul 30, 2011
Posts: 25

Why we use EJB ? Can't we develop applications without EJB ?

Kavisha Paranamana - Homepage
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63857

Of course you can. I've never used EJBs for anything.

[Asking smart questions] [About Bear] [Books by Bear]
Jayr Motta
Ranch Hand

Joined: Jul 30, 2010
Posts: 110


EJB makes easy tasks that most part of enterprise applications requires nowadays. There are obviously a lot of other solutions that can replace or also co-exist with EJB like Spring.

The thing is, EJB is about simplicity. You'll write just a little or none XML, you'll have a lot of cool defaults like transaction management implicit, avoid concurrent programming, security management, message-oriented middleware and so on.

I like to state that EJB nowadays are for those that are looking for something really simple while Spring is used by those looking for a lot of flexibility and versatility, but will pay a slightly higher price on complexity.

Most of the great vendors like IBM, Oracle, Caucho, Red Hat, Jetty, and a lot other great vendors implement the EJB specification on their application server. And even Spring on its documentation makes a lot of references to the concepts created on the specification, sometimes even using the same concepts (transaction management is an example). You'll be able to expose your business objects through web services or through sockets, to cluster them in order to achieve higher scalability, fail tolerance and availability.

The EJB 3.2 specification is already on the JCP and the rumors said that it will be adapted to be used on cloud environments, also Hibernate released OGM that probably could be used as the next generation of JPA.

That's it, keep in mind that you should always be simpler as possible and yet have the mind opened. Right now I'm working with Spring 3 but I'm a big fan of the EJB specification and expert groups!

Feel free to ask me anything!!/ref=jmotta, SCJP 6, OCWCD JEE5, OCE EJB JEE6
Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

Jayr Motta wrote: also Hibernate released OGM that probably could be used as the next generation of JPA.

Actually it's not really next generation JPA. Hibernate OGM is a JPA implementation for non-relational datastores.

[My Blog] [JavaRanch Journal]
Jayr Motta
Ranch Hand

Joined: Jul 30, 2010
Posts: 110


I agree with you. But EJB 3.2 specification, will focus on cloud until where I know. And relational doesn't fits too well as non-relation does. There are already a lot of implementation in this nature like Objectify and also JPA over non-relational databases but with limitations given it's relational nature.

I think the next step will be create some kind of hook on the JPA specification to this kind of "world" and to those that read the OGM birth post have seen that a lot of things from the "original" Hibernate will be reused, if it's possible, the expert group will certainly find a way to create a hook or even a new specification to it (for god sake, one more? :P).

But I can be wrong and I'm certainly just speculating, but that's what I truly believe. What you think about it?
I agree. Here's the link:
subject: Why we use EJB
It's not a secret anymore!