You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Christian Reiter <c....@gmx.net> on 2010/03/18 10:07:45 UTC

wicket-contrib-javaee: @EJB injection - injecting always the same instance regardless of session

Hi!

I've just started using the @EJB injection annotation from 
wicket-contrib-javaee.
I use it to inject a Stateful Session Bean to keep track of my user 
session and do some
stuff like authorization.

I thought the @EJB annotation keeps track of my sessions and would 
inject a unique instance of
the Stateful Session Bean for each of my Wicket session.

But, it injects always the same Stateful Session Bean instance 
completely ignoring my Wicket sessions. In this case it is useless to 
keep track of my users.

Am i doing anything wrong or is this the intended behaviour?

Would it be better to get the Stateful Session Bean by a lookup call and 
then store it in the
Wicket session?

Thanks for your help!

Best Regards,
  christian

-- 
Christian Reiter    |||    c.reiter@gmx.net


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: wicket-contrib-javaee: @EJB injection - injecting always the same instance regardless of session

Posted by Major Péter <ma...@sch.bme.hu>.
Hi,

At first thought, please try your code out with wicketstuff
javaee-inject, but it will most likely behave just the same.
You cannot store your bean in session, because AFAIK they're not
serializable.
Please rise an issue for this (also quickstart would be great), and I
will look into it.

Best Regards,
Peter Major

2010-03-18 10:07 keltezéssel, Christian Reiter írta:
> Hi!
> 
> I've just started using the @EJB injection annotation from
> wicket-contrib-javaee.
> I use it to inject a Stateful Session Bean to keep track of my user
> session and do some
> stuff like authorization.
> 
> I thought the @EJB annotation keeps track of my sessions and would
> inject a unique instance of
> the Stateful Session Bean for each of my Wicket session.
> 
> But, it injects always the same Stateful Session Bean instance
> completely ignoring my Wicket sessions. In this case it is useless to
> keep track of my users.
> 
> Am i doing anything wrong or is this the intended behaviour?
> 
> Would it be better to get the Stateful Session Bean by a lookup call and
> then store it in the
> Wicket session?
> 
> Thanks for your help!
> 
> Best Regards,
> christian

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: wicket-contrib-javaee: @EJB injection - injecting always the same instance regardless of session

Posted by Manfred Bergmann <ma...@gmx.net>.
Hi.

AFAIK a Wicket user session and a EJB Session are separated. Meaning that
the EJB container decides whether a new EJB instance needs to be created or
not. However even if multiple Wicket sessions get the same EJB instance the
EJB container will still ensure proper synchronisation and transaction
management.


Manfred


t3_chris wrote:
> 
> Hi!
> 
> I've just started using the @EJB injection annotation from 
> wicket-contrib-javaee.
> I use it to inject a Stateful Session Bean to keep track of my user 
> session and do some
> stuff like authorization.
> 
> I thought the @EJB annotation keeps track of my sessions and would 
> inject a unique instance of
> the Stateful Session Bean for each of my Wicket session.
> 
> But, it injects always the same Stateful Session Bean instance 
> completely ignoring my Wicket sessions. In this case it is useless to 
> keep track of my users.
> 
> Am i doing anything wrong or is this the intended behaviour?
> 
> Would it be better to get the Stateful Session Bean by a lookup call and 
> then store it in the
> Wicket session?
> 
> Thanks for your help!
> 
> Best Regards,
>   christian
> 
> -- 
> Christian Reiter    |||    c.reiter@gmx.net
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/wicket-contrib-javaee%3A-%40EJB-injection---injecting-always-the-same-instance-regardless-of-session-tp27943127p27947476.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org