Java Reference
In-Depth Information
returned to the presentation tier, which eliminates the need to write
DTO
s. In
addition, because
EJB 3
provides dependency injection, session and message-
driven beans rarely need to call
JNDI
to access their dependencies.
EJB 3
has sensi-
ble defaults for many
EJB
configuration options, which means very little configu-
ration is required. If you are coming to
EJB 3
from
EJB 2
you will find it
considerably easier to use.
But if you are already using lightweight technologies such as Spring, Hiber-
nate, and
JDO
, you will be disappointed. The
O/R
mapping defined in the June
2005 public draft had many limitations, including a lack of support for collections
of primitive types, and limited support for lists and maps. As a result, you must
decide between writing extra code and using vendor-specific features.
Assembling an application's components is a lot more difficult than when
using Spring because
EJB
dependency injection can only inject
JNDI
objects into
EJB
s. You must implement all of the components as
EJB
s, explicitly call the Spring
bean factory, or expose Spring beans through
JNDI
. Furthermore, you have to
deal with the complexities of integrating an
EJB
container into your development
environment and live with the overhead of deploying session and message-driven
beans. Even though they are
POJO
s, they must still run in the
EJB
container.
Despite these problems,
EJB 3
will undoubtedly be used widely because it's part
of the J2EE standard. However, it is just another implementation option available
to enterprise Java developers and, like all options, it has both benefits and draw-
backs. It is important to make careful decisions and remain focused on the goal of
simpler and faster development rather than being driven by fads and dogma.
Search WWH ::
Custom Search