An easier life with EJB
Less than a month ago, JiPi and I were trying to choose the right architecture
for a web project. We’d more or less decided to use
Hibernate for ORM. The debate was over the rest of the system. The choice was between
a pure EJB implementation and a POJO-style implementation
using Spring.
Neither of us was satisfied staying in the realm of theory, so we agreed
to build a simple example (my implementation) that transferred money from one account to another. In the end
we chose Spring. One thing still bothered me, though:
I didn’t know how to implement a general equivalent of a stateful bean. Today I was
delighted to come across
Spring and EJB
by Rob Harrop and Jan Machacek (could he be a fellow Czech?), which is also a teaser for their
book Pro Spring.
The article describes very well how to use Spring’s features to make working with EJBs easier.
I really like the article and started thinking we might
use EJBs together with Spring after all. That line of thought hit a snag when I
read the discussion on TSS,
where He Yu rightly says, “I think the article hava a bug for statefull session bean implemention, because the BeanFactory have no any session management for beans it managed. After ejbPassivate all the
state will not be restored.” That gave me pause. I’d say the service
is serializable, so it should be possible to preserve the state, but I wouldn’t stake my life on it.
Related articles
Related CZ Podcast episodes
- #3 · Java 6 SE, Vývoj webových aplikací
Dagi and Filemon discuss Java 6 and web application frameworks. · Czech audio
- #1 · Vývojová prostředí v Javě
The first CZ Podcast episode looks at Java development environments. · Czech audio