Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about @Resource annotation

 
Peter Bugyi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

Could somebody explain to me what is the difference between the mappedName and the lookup property?

package javax.annotation;
@Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME)
public @interface Resource
{
public enum AuthenticationType {
CONTAINER,
APPLICATION
}
String name( ) default "";
Class type( ) default Object.class;
AuthenticationType authenticationType( ) default AuthenticationType.CONTAINER;
boolean shareable( ) default true;
String description( ) default "";
String mappedName( ) default "";
String lookup( ) default "";
}
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The "mappedName" is used to identify the resource in JNDI, but it is container specific. The way you write it depends on the container, so it's not portable. To come over this problem, the "lookup" attribute was added to J2EE6. You can use it to specify the complete JNDI path to your resource, and this will work with any containers.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic