struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: struts + EJBs?
Date Wed, 16 Oct 2002 18:13:13 GMT

This is an interesting question - and there are people strongly on both

Having solved this problem both ways, here's what I have found.

Pro-EJB arguments:

 - EJB Containers provide superior flexibility when it comes to transaction
management. Transaction requirements can be set declaratively (by changing
the deployment descriptor rather than the code). You can pretty easily have
different methods on different beans use different transaction strategies
and everything is taken care of by the container. Makes this stuff much
more manageable.
 - This is particularly useful if you have to update multiple databases
within a single transaction - depending on your setup, your database may
not be able to handle this.
 - EJB Containers also handle all the details of connection pooling, etc.
You just grab a handle to the bean and go.
 - One of the overlooked advantages is that EJB containers bring with them
other technologies. For example, if you use JBoss it comes with JNDI, an
RMI server, JBossMQ (for JMS), and JBoss.NET (Web Service integration using
 - In the next EJB Spec (EJB 2.1), EJB's are required to be accessible via
SOAP - this is actually a big deal. It means if you create an EJB, then
converting it to a Web Service will be potentially easier than if you
implement your own model components. Of course, this is a little bit away
 - Since you'd likely use Torque or some other O/R mapping tool, you have
to learn another technology and spend time configuring it anyway - you may
as well spend that time creating Entity Beans.
 - If you don't use an EJB container and have all the developers 'roll
their own', you can end up with everyone writing their code differently and
have the identical JDBC properties in 20 properties files throughout your
application. Then when you change the database name, it takes you hours to
track them all down (and of course, you miss a few).
- Reuse can be easier. If you have a particular entity bean in place
already and write a new app that needs the data, the new app can just
access the bean without worrying about the first app. The EJB container
will coordinate everything.


 - EJB Containers can be a pain and a time sink of you get the wrong one.
JBoss is actually one of the easiest choices.
- It's YANTTL (yet another new technology to learn) which can slow you
down. Especially since probably not everyone on your team will learn it
well. Getting started can be hard.
 - The learning curve is steeper for EJB than for a simpler O/R tool like
Torque (or whichever). It takes longer for all the developers to get up to
speed and can slow the project down.
 - Since so much of your code requires Container-provided services, Unit
Testing is more complex. Cactus can be used to accomplish this (YANTTL
again) and you need to have a container available in order to perform unit
testing. Once you get this set up it's not too bad.
- Non-EJB approaches easier to get started with.
 - Sometimes an EJB container is just overkill. If you have a simple app it
can take longer for both development and system configuration.
- Building and deploying the code is usually more complex - again JBoss is
among the easiest.

I think in the end its something that once you know the technology well and
are comfortable with it, it's actually better to have the EJB container.
This is because you you get the other services (JMS, etc) that come with
J2EE and plus managing transactions and pooling is simpler. And creating
the beans takes about the same time as creating models using other O/R
tools. But getting yourself and others up to speed won't happen overnight.

Good luck -

Vincent Stoessel <> on 10/16/2002 12:49:59 PM

Please respond to "Struts Users Mailing List"

To:    Struts Users <>
cc:     (bcc: Kevin Bedell/Systems/USHO/SunLife)
Subject:    struts +  EJBs?

I am using struts 1.1b2
I am finding that modeling my business logic in custom beans seems to be
working fine for me in tomcat 4.1.x enviroment. I know that my
management would really like for me to add the buzz compliant EJBs to
the mix. I was looking at using jboss. Can some pro-Jboss/EJB person
tell why in the world I need to be using EJB instead of using my own
model classes? it is a relatively small app but an important one for the
Vincent Stoessel
Linux Systems Developer

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

This e-mail message (including attachments, if any) is intended for the use
of the individual or entity to which it is addressed and may contain
information that is privileged, proprietary , confidential and exempt from
disclosure.  If you are not the intended recipient, you are notified that
any dissemination, distribution or copying of this communication is
strictly prohibited.  If you have received this communication in error,
please notify the sender and erase this e-mail message immediately.

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message