On Wed, Aug 27, 2008 at 3:46 AM, Alexander Baetz
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> i'm currently working on a new Interceptor for EJB Injection on Actions. I
> allready extendet it to work on fields and methods. But since i dont like to
> make my own Annotation type i wanted to use the javax.ejb.ejb anotation.

I tried to do something similar once and came to the conclusion that
it is not a good idea.

> the annotation used by the ejb3-plugin for struts 2 has a field that
> determines if the bean is statefull or stateless. I don't have this bean, so
> how do i determine for the injection if the bean is statefull?

Basically, you don't.  The best you can do (and someone please correct
me if I'm wrong) is do a JNDI lookup the first time you need the
session bean and then store its reference in the HttpSession.  That's
the only way to make stateful session beans work at all and it doesn't
hurt stateless session beans.

Now this creates two problems.  1) You're dumping crap in the session,
which is bad for all the usual reasons and 2) stateful session beans
aren't guaranteed to be thread-safe.  That means if someone
double-posts a form they could end up with an error page.  It also may
cause problems with AJAX pages creating multiple concurrent requests.

These are major headaches that JBoss Seam was specifically designed to
address.  Now just to be clear, JSF makes me gag and I'm not trying to
pimp a framework I've never used.  What I am saying though, is that if
EJB 3 is a requirement for your app, Struts may not be the best
choice.

I'd be curious to hear if anyone has really pulled off good Java EE 5
integration.  I'd guess that the majority around here are using Spring
or Guice instead.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to