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 Index annotation is used in schema generation. Note that it is not necessary to specify an index
019 * for a primary key, as the primary key index will be created automatically, however, the Index annotation
020 * may be used to specify the ordering of the columns in the index for the primary key.
021 *
022 * @since JPA 2.1
023 */
024@Target({})
025@Retention(RUNTIME)
026public @interface Index {
027  /**
028   * (Optional) The name of the index.  Defaults to a provider-generated value.
029   *
030   * @return The index name
031   */
032  String name() default "";
033
034  /**
035   * (Required) The names of the columns to be included in the index.
036   *
037   * @return The names of the columns making up the index
038   */
039  String columnList();
040
041  /**
042   * (Optional) Whether the index is unique.  Default is false.
043   *
044   * @return Is the index unique?
045   */
046  boolean unique() default false;
047}