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 * Groups {@link PrimaryKeyJoinColumn} annotations.
020 * It is used to map composite foreign keys.
021 * <p>
022 * <pre>
023 *    Example: ValuedCustomer subclass
024 *
025 *    &#064;Entity
026 *    &#064;Table(name="VCUST")
027 *    &#064;DiscriminatorValue("VCUST")
028 *    &#064;PrimaryKeyJoinColumns({
029 *        &#064;PrimaryKeyJoinColumn(name="CUST_ID",
030 *            referencedColumnName="ID"),
031 *        &#064;PrimaryKeyJoinColumn(name="CUST_TYPE",
032 *            referencedColumnName="TYPE")
033 *    })
034 *    public class ValuedCustomer extends Customer { ... }
035 * </pre>
036 *
037 * @since Java Persistence 1.0
038 */
039@Target({TYPE, METHOD, FIELD})
040@Retention(RUNTIME)
041public @interface PrimaryKeyJoinColumns {
042  PrimaryKeyJoinColumn[] value();
043
044  /**
045   * (Optional) The foreign key constraint specification for the join columns. This is used only if table
046   * generation is in effect. Default is provider defined.
047   *
048   * @return The foreign key specification
049   */
050  ForeignKey foreignKey() default @ForeignKey();
051}