001/* 002 * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. 003 * 004 * This program and the accompanying materials are made available under the 005 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 006 * which accompanies this distribution. The Eclipse Public License is available 007 * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License 008 * is available at http://www.eclipse.org/org/documents/edl-v10.php. 009 */ 010package javax.persistence; 011 012import java.lang.annotation.Retention; 013import java.lang.annotation.Target; 014 015import static java.lang.annotation.ElementType.*; 016import static java.lang.annotation.RetentionPolicy.RUNTIME; 017 018/** 019 * Used to override mappings of multiple relationship properties or fields. 020 * <p> 021 * <pre> 022 * 023 * Example: 024 * 025 * @MappedSuperclass 026 * public class Employee { 027 * 028 * @Id protected Integer id; 029 * @Version protected Integer version; 030 * @ManyToOne protected Address address; 031 * @OneToOne protected Locker locker; 032 * 033 * public Integer getId() { ... } 034 * public void setId(Integer id) { ... } 035 * public Address getAddress() { ... } 036 * public void setAddress(Address address) { ... } 037 * public Locker getLocker() { ... } 038 * public void setLocker(Locker locker) { ... } 039 * ... 040 * } 041 * 042 * @Entity 043 * @AssociationOverrides({ 044 * @AssociationOverride( 045 * name="address", 046 * joinColumns=@JoinColumn("ADDR_ID")), 047 * @AttributeOverride( 048 * name="locker", 049 * joinColumns=@JoinColumn("LCKR_ID")) 050 * }) 051 * public PartTimeEmployee { ... } 052 * </pre> 053 * 054 * @see AssociationOverride 055 * @since Java Persistence 1.0 056 */ 057@Target({TYPE, METHOD, FIELD}) 058@Retention(RUNTIME) 059public @interface AssociationOverrides { 060 061 /** 062 * (Required) The association override mappings that are to be 063 * applied to the relationship field or property . 064 */ 065 AssociationOverride[] value(); 066}