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.RetentionPolicy.RUNTIME;
016
017/**
018 * The ForeignKey annotation is used in schema generation. It is used to define a foreign key constraint or to
019 * override or disable the persistence provider’s default foreign key definition.
020 *
021 * @since JPA 2.1
022 */
023@Target({})
024@Retention(RUNTIME)
025public @interface ForeignKey {
026  /**
027   * (Optional) The name of the foreign key constraint.  Defaults to a provider-generated name.
028   *
029   * @return The foreign key name
030   */
031  String name() default "";
032
033  /**
034   * (Optional) The foreign key constraint definition.  Default is provider defined.  If the value of
035   * disableForeignKey is true, the provider must not generate a foreign key constraint.
036   *
037   * @return The foreign key definition
038   */
039  String foreignKeyDefinition() default "";
040
041  /**
042   * (Optional) Used to specify whether a foreign key constraint should be generated when schema generation is in effect.
043   *
044   * @return mode
045   */
046  ConstraintMode value() default ConstraintMode.CONSTRAINT;
047}