Index
This commit is contained in:
@@ -14,8 +14,10 @@
|
|||||||
***************************************************************************** */
|
***************************************************************************** */
|
||||||
package org.redkale.persistence;
|
package org.redkale.persistence;
|
||||||
|
|
||||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
import java.lang.annotation.Documented;
|
||||||
|
import static java.lang.annotation.ElementType.TYPE;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
|
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,7 +42,8 @@ import java.lang.annotation.Target;
|
|||||||
* @since Java Persistence 2.1
|
* @since Java Persistence 2.1
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Target({})
|
@Documented
|
||||||
|
@Target(TYPE)
|
||||||
@Retention(RUNTIME)
|
@Retention(RUNTIME)
|
||||||
public @interface Index {
|
public @interface Index {
|
||||||
|
|
||||||
@@ -55,9 +58,9 @@ public @interface Index {
|
|||||||
* (Required) The names of the columns to be included in the index,
|
* (Required) The names of the columns to be included in the index,
|
||||||
* in order.
|
* in order.
|
||||||
*
|
*
|
||||||
* @return String
|
* @return String[]
|
||||||
*/
|
*/
|
||||||
String columnList();
|
String[] columns();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (Optional) Whether the index is unique.
|
* (Optional) Whether the index is unique.
|
||||||
@@ -66,4 +69,19 @@ public @interface Index {
|
|||||||
*/
|
*/
|
||||||
boolean unique() default false;
|
boolean unique() default false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index的多用类
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* 详情见: https://redkale.org
|
||||||
|
*
|
||||||
|
* @author zhangjx
|
||||||
|
*/
|
||||||
|
@Documented
|
||||||
|
@Target(TYPE)
|
||||||
|
@Retention(RUNTIME)
|
||||||
|
public static @interface Indexs {
|
||||||
|
|
||||||
|
Index[] value();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,10 +15,10 @@
|
|||||||
***************************************************************************** */
|
***************************************************************************** */
|
||||||
package org.redkale.persistence;
|
package org.redkale.persistence;
|
||||||
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import static java.lang.annotation.ElementType.TYPE;
|
import static java.lang.annotation.ElementType.TYPE;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies the primary table for the annotated entity. Additional
|
* Specifies the primary table for the annotated entity. Additional
|
||||||
@@ -59,29 +59,6 @@ public @interface Table {
|
|||||||
*/
|
*/
|
||||||
String catalog() default "";
|
String catalog() default "";
|
||||||
|
|
||||||
/**
|
|
||||||
* (Optional) Unique constraints that are to be placed on
|
|
||||||
* the table. These are only used if table generation is in
|
|
||||||
* effect. These constraints apply in addition to any constraints
|
|
||||||
* specified by the <code>Column</code> and <code>JoinColumn</code>
|
|
||||||
* annotations and constraints entailed by primary key mappings.
|
|
||||||
* <p>
|
|
||||||
* Defaults to no additional constraints.
|
|
||||||
* @return UniqueConstraint[]
|
|
||||||
*/
|
|
||||||
UniqueConstraint[] uniqueConstraints() default {};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* (Optional) Indexes for the table. These are only used if
|
|
||||||
* table generation is in effect. Note that it is not necessary
|
|
||||||
* to specify an index for a primary key, as the primary key
|
|
||||||
* index will be created automatically.
|
|
||||||
*
|
|
||||||
* @return indexes
|
|
||||||
* @since Java Persistence 2.1
|
|
||||||
*/
|
|
||||||
Index[] indexes() default {};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* comment
|
* comment
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
/** *****************************************************************************
|
|
||||||
* Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
|
|
||||||
*
|
|
||||||
* This program and the accompanying materials are made available under the
|
|
||||||
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
|
|
||||||
* which accompanies this distribution.
|
|
||||||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
* and the Eclipse Distribution License is available at
|
|
||||||
* http://www.eclipse.org/org/documents/edl-v10.php.
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Linda DeMichiel - Java Persistence 2.1
|
|
||||||
* Linda DeMichiel - Java Persistence 2.0
|
|
||||||
*
|
|
||||||
***************************************************************************** */
|
|
||||||
package org.redkale.persistence;
|
|
||||||
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies that a unique constraint is to be included in
|
|
||||||
* the generated DDL for a primary or secondary table.
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* Example:
|
|
||||||
* @Entity
|
|
||||||
* @Table(
|
|
||||||
* name="EMPLOYEE",
|
|
||||||
* uniqueConstraints=
|
|
||||||
* @UniqueConstraint(columnNames={"EMP_ID", "EMP_NAME"})
|
|
||||||
* )
|
|
||||||
* public class Employee { ... }
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @since Java Persistence 1.0
|
|
||||||
*/
|
|
||||||
@Target({})
|
|
||||||
@Retention(RUNTIME)
|
|
||||||
public @interface UniqueConstraint {
|
|
||||||
|
|
||||||
/** (Optional) Constraint name. A provider-chosen name will be chosen
|
|
||||||
* if a name is not specified.
|
|
||||||
*
|
|
||||||
* @return String
|
|
||||||
* @since Java Persistence 2.0
|
|
||||||
*/
|
|
||||||
String name() default "";
|
|
||||||
|
|
||||||
/** (Required) An array of the column names that make up the constraint.
|
|
||||||
*
|
|
||||||
* @return String[]
|
|
||||||
*/
|
|
||||||
String[] columnNames();
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user