]On Aug 7, 2008, at 8:00 AM, Vamsavardhana Reddy wrote:

I am using DeploymentLoader to process an EJB3 annotated ejb jar and obtain meta-data complete descriptors. I am using @EJB annotation to inject a session bean. I am noticing that even though the business interface has no @Remote annotation on it is resulting in an EjbRef rather than EjbLocalRef. (I am examining the org.apache.openejb.jee.SessionBean object created).
Isn't EjbRef used for remote references?  If I specify @Local on the
business interface explicitly then it is resulting in EjbLocalRef. Doesn't
absence of @Remote on the interface mean the interface is local?

The deployment descriptor is the ultimate authority so truthfully we're not exactly safe assuming that we should use EjbLocalRef when the interface is annotated with @Local. For all intense purposes we don't know what kind of ref an @EJB to a 3.0 business interface will end up being until we resolve it and see how the referee classified that business interfaces.

If not, what is the idea behind the way it is working now?

Right, so the way we have it now is that when in doubt we use the EjbRef. We added a little non-xml field that allows us to flag it as ambiguous:

    @XmlTransient
    protected Type refType = Type.REMOTE;

    public Type getRefType() {
        return refType;
    }

So leaving the AnnotationDeployer, that method will return Type.REMOTE or Type.UNKNOWN. Later on in the deployment chain when we resolve the reference to the target bean we potentially update that yet again to be Type.LOCAL.

-David

Reply via email to