dev@glassfish.java.net

heads up: changes in default name for environment annotations

From: Hong Zhang <Hong.Zhang_at_Sun.COM>
Date: Thu, 04 Aug 2005 10:45:19 -0400

Hi, all

I will be checking in some changes for the default name of the
environment annotations (such as @resource, @ejb).
When the name() is not specified within the annotation, the old
implementation was to use the field name or the java bean property name.
Now according to the spec (J2EE.5.2.3, attached at the end of this
email), the default name should be this: fully-qualified name of the
.class in which the annotation is defined followed by forward slash
followed by field or java bean property name.

This change will break some tests. Any application that was relying on
the previous default of only the field/property name will break. The
most common usages are either doing a direct lookup of the resource in
jndi or using the logical name to map to a phyiscal resource within
sun-*.xml. In these cases, you will need to prefix the old default name
with the fully-qualified declaring class name.

Let me know if you have any question.


Thanks,

- Hong


J2EE.5.2.3
=================
A field of a class may be the target of injection. The field may not be
final. By default, the name of the field is combined with the fully
qualified name of the class and used directly as the name in the
application component’s naming context. For example, a field named
myDatabase in the class MyApp in the package com.example would
correspond to the JNDI name java:comp/env/com.example.MyApp/myDatabase.
The annotation also allows the JNDI name to be specified explicitly.
When a deployment descriptor entry is used to specify injection, the
JNDI name and the field name are both specified explicitly. Note that
the JNDI name is always relative to the java:comp/env naming context.