| 
 | Java EE 5 SDK | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | ||||||||
@Target(value={TYPE,METHOD,FIELD})
@Retention(value=RUNTIME)
public @interface AssociationOverrideThis annotation is used to override a many-to-one or one-to-one mapping of property or field for an entity relationship.
 The AssociationOverride annotation may be applied
 to an entity that extends a mapped superclass to override a many-to-one
 or one-to-one mapping defined by the mapped superclass. If the
 AssociationOverride annotation is not specified, the join
 column is mapped the same as in the original mapping.
 
    Example:
    @MappedSuperclass
    public class Employee {
        ...
        @ManyToOne
        protected Address address;
        ...
    }
    
    @Entity 
    @AssociationOverride(name="address", 
        joinColumns=@JoinColumn(name="ADDR_ID"))
    // address field mapping overridden to ADDR_ID fk
    public class PartTimeEmployee extends Employee {
        ...
    }
 
OneToOne, 
ManyToOne, 
MappedSuperclass| Required Element Summary | |
|---|---|
|  JoinColumn[] | joinColumnsThe join column that is being mapped to the persistent attribute. | 
|  String | nameThe name of the relationship property whose mapping is being overridden if property-based access is being used, or the name of the relationship field if field-based access is used. | 
| Element Detail | 
|---|
public abstract String name
public abstract JoinColumn[] joinColumns
| 
 | Java EE 5 SDK | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | ||||||||
Copyright 2006 Sun Microsystems, Inc. All rights reserved.