persistence@glassfish.java.net

Re: Need a reference to an Session Bean within an Entity Bean

From: Craig L Russell <Craig.Russell_at_Sun.COM>
Date: Mon, 30 Jul 2007 12:00:44 -0700

Hi Kem,

Can you model this as an EJB that is created by other EJBs and that
contacts the third party web service plus the Entity?

Craig

On Jul 30, 2007, at 11:47 AM, Kem Elbrader wrote:

> I have an entity which has a few properties that aren't persisted to
> the database but rather obtained from a third party web service. How
> would you suggest going about accomplishing this?
>
> On 7/30/07, Craig L Russell <Craig.Russell_at_sun.com> wrote:
>> Hi Kem,
>>
>> I'd suggest you rework your design such that you only use references
>> "from" EJBs "to" Entities and other EJBs.
>>
>> Having Entities reference EJBs violates the basic POJO model.
>>
>> Regards,
>>
>> Craig
>>
>> On Jul 30, 2007, at 11:22 AM, Kem Elbrader wrote:
>>
>>> Is it possible to inject an EJB into an Entity? If not is there
>>> another way to get a reference to a EJB from an Entity?
>>>
>>> Example:
>>>
>>> @Entity
>>> public class Customer {
>>>
>>> @EJB
>>> CustomerAction customerAction;
>>>
>>> @PostLoad
>>> void initialize() {
>>> // do stuff with customerAction...
>>> }
>>> }
>>
>> Craig Russell
>> Architect, Sun Java Enterprise System http://java.sun.com/products/
>> jdo
>> 408 276-5638 mailto:Craig.Russell_at_sun.com
>> P.S. A good JDO? O, Gasp!
>>
>>
>>

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell_at_sun.com
P.S. A good JDO? O, Gasp!