tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From karl.kil...@gmail.com
Subject Re: Regarding @Inject vs @EJB for EJB
Date Fri, 03 Oct 2014 14:49:33 GMT
Hi, 
I am not sure about that Alex. I use @Inject only and Stateless and stuff is  working fine

Skickat från min iPhone

> 3 okt 2014 kl. 15:30 skrev Alex Soto <asotobu@gmail.com>:
> 
> Well I don't know exactly how EJB and CDI is managed internally by TomEE.
> But using @Inject whatever the class is will mean that the lifecycle of
> that instance will be managed by CDI container. On the other side if you
> use @EJB the bean will be managed by EJB container, and this means EJB
> lifecycle, and of course that your bean wil be transactional and you will
> be able to apply security concerns.
> 
> Note that @Inject will make your bean be treated as POJO meanwhile @EJB
> will mean that your bean will be treated as Enterprise Java Bean.
> 
> As I said I am not 100% sure but I think this is how it works.
> 
> 2014-10-03 14:19 GMT+02:00 Lars-Fredrik Smedberg <itsmeden@gmail.com>:
> 
>> Hi!
>> 
>> I'm trying to understand how I can use @Inject to inject EJBs.
>> 
>> 1. If I want to inject an EJB that is packaged in the WAR together with the
>> code trying to inject it i assume I can use @Inject, correct?
>> 2. As 1 but the EJB is packaged in a separate ejb-jar. I assume I can still
>> use @Inject correct?
>> 3. If the EJB is packaged in another WAR inside the same EAR or in another
>> EAR I need to use @EJB correct?
>> 4. In case 3 how do I adress the EJB? Where can I read more about the
>> naming standard?
>> 
>> Regards
>> LF
>> 
>> --
>> Med vänlig hälsning / Best regards
>> 
>> Lars-Fredrik Smedberg
>> 
>> STATEMENT OF CONFIDENTIALITY:
>> The information contained in this electronic message and any
>> attachments to this message are intended for the exclusive use of the
>> address(es) and may contain confidential or privileged information. If
>> you are not the intended recipient, please notify Lars-Fredrik Smedberg
>> immediately at itsmeden@gmail.com, and destroy all copies of this
>> message and any attachments.
>> 
> 
> 
> 
> -- 
> +----------------------------------------------------------+
>  Alex Soto Bueno - Computer Engineer
>  www.lordofthejars.com
> +----------------------------------------------------------+

Mime
View raw message