Subversion Repositories WebE

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
33 PointedEar 1
package javax.persistence;
2
 
3
import static java.lang.annotation.ElementType.METHOD;
4
import static java.lang.annotation.ElementType.FIELD;
5
import static java.lang.annotation.RetentionPolicy.RUNTIME;
6
import java.lang.annotation.Target;
7
import java.lang.annotation.Retention;
8
 
9
/**
10
 * Is used to specify the map key for associations of type Map.
11
 * If a persistent field or property other than the primary key is used as a map key then it
12
 * is expected to have a uniqueness constraint associated with it.
13
 *
14
 * @author Emmanuel Bernard
15
 */
16
@Target({METHOD, FIELD}) @Retention(RUNTIME)
17
public @interface MapKey {
18
        /**
19
         * The name of the persistent field or property of the associated entity that is used as the map key.
20
         * If the name element is not specified, the primary key of the associated entity is used as the map key.
21
         * If the primary key is a composite primary key and is mapped as IdClass, an instance of the primary key
22
         * class is used as the key.
23
         */
24
        String name() default "";
25
}