users@glassfish.java.net

name, mappedName, unitName... getting confused

From: Antonio Goncalves <antonio.mailing_at_gmail.com>
Date: Wed, 15 Nov 2006 17:39:34 +0100

Hi everybody. I'm getting a bit confused with some EJB annotations
attributes.

The first one is @Stateless (or @Stateful). What is the name attribute used
for ? In the specification it says that it's the name of the EJB. But on the
other hand, when I change it nothing happens but when I use the mappedName
attribute (which is vendor specific), it really changes the name of my EJB
in the JNDI tree. For example :

@Stateless(mappedName = "ejb/stateless/Catalog")
public class CatalogBean implements CatalogRemote, CatalogLocal {}

This changes the name of the EJB to "ejb/stateless/Catalog". But if I use
the attribute name, the name doesn't change.


The other one is @PersistenceContext. The name attribute doesn't lead me
anywhere (I can't see any difference in using it or not) ant the other is
unitName that has to be equal to the persitent unit name within the
persistence.xml file. The spec doesn't talk about any vendor specific
attribute but I don't understand what the name attribute can be used for.

Does any body has clearer ideas than I have ?

Thanks,

Antonio