That's indeed an old dispute...
I'd strongly recommend reading the following interesting books:
- "Bitter EJB's"
- "J2EE Development without EJB"
Many people are not thrilled with EJB's, at least with the older EJB
2.1... some claim that in *some* aspects they're:
- too complicated / enforce and inconvenient architecture
- suffer from serious performance problems
- immature
Regarding your remark on distribution, the great Rod Johnson has
clamined that they're going for the wrong end of the "80:20" rule...
like 20% of the applications may need distributed services, but the
remaining 80% end up with an over-complex architecture they don't
need....
I've done some EJB programming, and what I liked about them is mainly
session beans, with the automated (declarative):
- security
- transactions
Both of these are *very* hard to implement without a container (you'll
probably need Aspect Oriented Programming). Otherwise, I have to do
code reviews for everybody, making sure they always do appropriate
transactions, close connections, and don't expose methods to people who
shouldn't be allowed to call them...
(Mind you, security features weren't strong enough for us, but we did
use it as a "safety net", with additional applicative checks).
Still, bottom line - I'm not crazy about EJB's either. When I do use
them, I'll try to stick with Stateless Session Beans (which give some
decent features), and i'll stay away from Entity Beans.
I can only suggest you try them out *very, very carefully* and form
your own opinion...
Also have a look at EJB 3.0, which is supposed to be a hugh improvement
(learning from the java community, and from accumulated experience)...