EJB good or bad
When it comes to EJB many people say it is a lot of overhead and we keep away from it. JSP and servlets solve all our business problems. I think EJB brings a lot of discipline to your code and should be used for all your transactional purposes.
The pattern can be like JSP - Java Bean - Servlet - Entity Bean - DAO. Then in case if somebody thinks that EJB is a overkill for just retrieving data in some case just do JSP - Servlet - DAO as DAOs are already created.
Am I in the right track? Any great suggestions welcome.
We are using JSPs, Java Beans, servlets, session EJBs and DAO on a client site with fairly good performance. The DAOs uses TOPLink as the persistence layer to Oracle so they don't use entity EJBs.
If your only justification for using EJBs is coding discipline, I'd recommend discarding that expensive EJB container, and purchasing a low cost baseball bat.
In fact, lazy developers will muddle buisiness and other logic all the way through your application if you let them. Having EJBs won't stop them. The baseball bat will.
Sylvia.
The old maxim "don't use EntityBeans" is (should?) be declining, especially with the advent of EJB 2.0. The newer spec eliminates a lot of the old complaints (and performance problems).
HOWEVER, they must still be used with care. They do not work well in situations where your data would have high-turnover in the container cache or large data volumes (those are where TopLink fails as well - memory usage is memory usage).
And you do have to evaluate exactly what benefit you would get from using EJBs, as well. Every project has it's own requirements and some applications are suitable for EJBs, some are not. There's no "hard and fast" rule that says which way is "best." Y'all have to decide that for yourselves. The transactional control and, equally importantly, abstraction of "business logic" are the major attractions.
And I'd go with sylviae on
> If your only justification for using EJBs
> is coding discipline, I'd recommend discarding
> that expensive EJB container, and purchasing a
> low cost baseball bat.