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 11:34:05 -0700

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!