diff --git a/src/main/java/org/redkale/persistence/Index.java b/src/main/java/org/redkale/persistence/Index.java index 10c6fc7dc..b84c821eb 100644 --- a/src/main/java/org/redkale/persistence/Index.java +++ b/src/main/java/org/redkale/persistence/Index.java @@ -14,8 +14,10 @@ ***************************************************************************** */ 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 static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Target; /** @@ -40,7 +42,8 @@ import java.lang.annotation.Target; * @since Java Persistence 2.1 * */ -@Target({}) +@Documented +@Target(TYPE) @Retention(RUNTIME) public @interface Index { @@ -55,9 +58,9 @@ public @interface Index { * (Required) The names of the columns to be included in the index, * in order. * - * @return String + * @return String[] */ - String columnList(); + String[] columns(); /** * (Optional) Whether the index is unique. @@ -66,4 +69,19 @@ public @interface Index { */ boolean unique() default false; + /** + * Index的多用类 + * + *
+ * 详情见: https://redkale.org
+ *
+ * @author zhangjx
+ */
+ @Documented
+ @Target(TYPE)
+ @Retention(RUNTIME)
+ public static @interface Indexs {
+
+ Index[] value();
+ }
}
diff --git a/src/main/java/org/redkale/persistence/Table.java b/src/main/java/org/redkale/persistence/Table.java
index b5277da76..dfda00e0e 100644
--- a/src/main/java/org/redkale/persistence/Table.java
+++ b/src/main/java/org/redkale/persistence/Table.java
@@ -15,10 +15,10 @@
***************************************************************************** */
package org.redkale.persistence;
-import java.lang.annotation.Target;
-import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
/**
* Specifies the primary table for the annotated entity. Additional
@@ -59,29 +59,6 @@ public @interface Table {
*/
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 Column and JoinColumn
- * annotations and constraints entailed by primary key mappings.
- *
- * 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 * diff --git a/src/main/java/org/redkale/persistence/UniqueConstraint.java b/src/main/java/org/redkale/persistence/UniqueConstraint.java deleted file mode 100644 index d06b5b19c..000000000 --- a/src/main/java/org/redkale/persistence/UniqueConstraint.java +++ /dev/null @@ -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. - * - *
- * Example:
- * @Entity
- * @Table(
- * name="EMPLOYEE",
- * uniqueConstraints=
- * @UniqueConstraint(columnNames={"EMP_ID", "EMP_NAME"})
- * )
- * public class Employee { ... }
- *
- *
- * @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();
-}