persistence@glassfish.java.net

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

From: Kem Elbrader <kem.elbrader_at_gmail.com>
Date: Mon, 30 Jul 2007 12:47:32 -0600

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!
>
>
>